Specifying CCSIDs for PL/I applications when using the Db2 coprocessor
If you are using the Db2 coprocessor to prepare a PL/I application with SQL statements, use the PL/I compiler to specify the CCSID of the application source code. For optimal performance, use Db2 to specify the CCSID of the application data in SQL statements.
About this task
The PL/I compiler accepts only one CCSID value that it uses for both the application source code and data. However, Db2 can accept one CCSID value for the source code and one or more CCSID values for the data that is manipulated in SQL statements through host variables and parameter markers.
Procedure
To specify CCSIDs for PL/I applications when using the Db2 coprocessor:
Example
The following table shows examples of the CCSID that Db2 uses for data in PL/I applications depending on the options that you specify.
| Variable | ENCODING bind option | PL/I options | CCSID that Db2 uses for the data | |
|---|---|---|---|---|
| PL/I CODEPAGE compiler option1 | PP(SQL) suboption | |||
| CHAR(n) | not explicitly specified | 1140 | NOCCSID0 | 11402 |
| CHAR(n) | not explicitly specified | 1140 | CCSID0 | Subsystem default application encoding scheme (DECP value APPENSCH)3 |
| CHAR(n) | 500 | 1140 | NOCCSID0 | 11402 |
| CHAR(n) | 500 | 1140 | CCSID0 | 5004 |
| CHAR(n) | UNICODE | 1140 | NOCCSID0 | 11402 |
| CHAR(n) | UNICODE | 1140 | CCSID0 | 1208 This CCSID and options combination does not logically make sense for PL/I. 5 |
| UCHAR(n) | 1208 | 1140 | CCSID0 | 12084 |
| WIDECHAR(n) | 1140 | 1140 | CCSID0 | 12006 |
- This value can be the value that you explicitly specify with the CODEPAGE compiler option or the default PL/I compiler code page.
- Because you specified NOCCSID0, Db2 uses the code page value from the PL/I compiler.
- Because you specified CCSID0, Db2 does not use the PL/I code page value. Additionally, because you did not explicitly specify a value for the ENCODING bind option, Db2 uses the default application encoding scheme.
- Because you specified CCSID0, Db2 does not use the PL/I code page value. Instead, Db2 uses the value that you specified for the ENCODING bind option.
- Because you specified CCSID0 and the ENCODING bind option UNICODE, Db2 uses CCSID 1208, which is UTF-8. Although you can specify this combination of options, do not do so. Specify compiler option CODEPAGE(1208) and the NOCCSID0 and CODEPAGE Db2 coprocessor coprocessor options instead.
- Because you specified a WIDECHAR variable, Db2 uses CCSID 1200.
/PLI EXEC PGM=IBMZPLI,PARM='...,PP(SQL("CCSID(37)"),...),...' 
