ODBC language considerations

The ODBC Driver in iSeries™ Access for Linux® handles many types of data conversions.

The character code page conversions involve using conversion tables and the iconv interfaces. Some of the conversion tables are shipped with the driver, others are downloaded from the server when needed. iconv is a library shipped with Linux that also handles character data conversions.

Coded Character Set Identifiers (CCSID)

The ODBC Driver in iSeries Access for Linux uses a pair (to and from) of Coded Character Set Identifiers (CCSID) to convert character data. The conversion uses a conversion table or the iconv interfaces.

Conversion Tables

Conversion tables are stored in /opt/ibm/iSeriesAccess/conv_tables and use the following naming convention:
<4 byte hex number of FROM CCSID><4 byte hex number of TO CCSID>.tbl 

For example, the conversation table for 819 to 500 is 033301f4.tbl.

Many conversion tables are shipped with the iSeries Access ODBC Driver. Additional conversion tables are downloaded from the server when they are needed. You can also download conversion tables using the CWBNLTBL utility.

ODBC Application Character Set

The ODBC application character set is defined by the current locale's character set. To find out the current locale, use the following command:

locale

To find out the current mapping between the current locale's character set and the CCSID that is used, use the following command:

/opt/ibm/iSeriesAccess/bin/cwbnltbl

Overriding the Character Set CCSID Mappings

To change or the add character set CCSID mapping, add the following lines to the $HOME/.iSeriesAccess/cwb_userprefs.ini configuration file.

[CWB_CURRUSER\Software\IBM\Client Access Express\CurrentVersion\NLS] CCSID-CODESET=attr_str:939,IBM939,819,IBM819

The above example creates mappings for CCSID 939 to character set "IBM939" and for CCSID 819 to character set "IBM819".

List of Available Locales

To list the available locales, use the following command:

locale -a

List of Available Iconv Character Sets

To list the available iconv character sets, use the following command:

 iconv -l

How to Investigate Conversion Problems

Most conversion problems are logged in the History Log. To turn on history logging, use the following command:
/opt/ibm/iSeriesAccess/bin/cwbtrc /hl:1
(Refer to CWBTRC for more about the trace utility.)

The history log output is in $HOME/.iSeriesAccess/cwbhistory-<application name-"$HOME/.iSeriesAccess/cwbhistory".csv. Use either a text editor or a spread sheet to view the contents of the history log.