Database

i5/OS™ PASE supports the DB2® UDB for iSeries™ Call Level Interface (CLI). DB2 CLI on AIX® and i5/OS are not proper subsets of each other, so there are minor differences in a few interfaces, and some APIs in one implementation might not exist in another.

Because of this, you should consider the following points:

i5/OS is an EBCDIC encoded system by default, while AIX is based on ASCII. This difference often requires data conversions between the i5/OS database (DB2 UDB for iSeries) and the i5/OS PASE application.

In the i5/OS PASE implementation of the DB2 CLI, i5/OS PASE system-provided library routines automatically perform data conversions from ASCII to Extended Binary Coded Decimal Interchange Code (EBCDIC) and back for character data. The conversions are made based on the tagged CCSID of the data being accessed and the ASCII CCSID under which the i5/OS PASE program is running. If the database is tagged, or if it is tagged with a CCSID of 65535, no automatic conversion takes place. It is left to the application to understand the encoding format of the data and to do any necessary conversion.

Work with CCSIDs

When you use the Qp2RunPase() API, you must explicitly specify the i5/OS PASE CCSID.

You can control the i5/OS PASE CCSID by setting both of these variables in the ILE before you call API program QP2TERM, QP2SHELL, or QP2SHELL2:

If the ILE omits either or both of these variables, QP2TERM, QP2SHELL, and QP2SHELL2 by default set the i5/OS PASE CCSID and i5/OS PASE environment variable LANG with the best i5/OS PASE equivalents of the language and CCSID attributes of your job.

Extensions to libc.a give the i5/OS PASE application the ability to change the running CCSID of the application, using the _SETCCSID() function.

Another extension gives the i5/OS PASE application the ability to override the DB2 CLI internal conversion without changing the CCSID of the application. The SQLOverrideCCSID400() function accepts an integer of the override CCSID as a single parameter.

Note: The CCSID override function SQLOverrideCCSID400() must be called before any other SQLx() API for the override to take effect; otherwise, the request is ignored.

Use the DB2 UDB for iSeries CLI in i5/OS PASE programs

To use DB2 CLI in your i5/OS PASE programs, you need to copy the sqlcli.h header file and the libdb400.exp export file to your AIX system before you compile your source. The DB2 CLI library routines are in libdb400.a for the i5/OS PASE environment, and are implemented using pthread interfaces, providing thread safety. Most i5/OS PASE CLI functions call corresponding ILE CLI functions to perform the required operation.

Note: When you use the DB2 CLIs in your i5/OS PASE programs, consider the following points:
  • SQLGetSubString always returns an EBCDIC string when sub-stringing the CLOB/DBCLOB field. The SQLGetSubString is used only for LOB data types.
  • SQLTables, column 4 of the result set (table type), is always returned as EBCDIC.
  • To render graphic-typed data in an i5/OS PASE program, the data must be typed in the program as wchar; this causes the database to convert from a graphic and pure double-byte character to Unicode/UCS-2. Otherwise, the database converts between the CCSID of the data and the CCSID of the i5/OS job. The database does not support conversion between EBCDIC graphic and the CCSID (either from the Qp2RunPase() API or the SQLOverrideCCSID400() API).
Related reference
Copy header files
Copy export files
Related information
QP2TERM()--Run an i5/OS PASE Terminal Session
QP2SHELL() and QP2SHELL2()--Run an i5/OS PASE Shell Program
_SETCCSID()--Set i5/OS PASE CCSID
SQLOverrideCCSID400()--Override SQL CLI CCSID for i5/OS PASE
SQL call level interface