When you use the integrated DB2 coprocessor (SQL compiler option), the code page for processing string
host variables in SQL statements is determined as shown below, in
descending order of precedence.
- A host variable that has USAGE NATIONAL is always processed by DB2 using CCSID 1200
(Unicode UTF-16). For example:
01 hostvariable pic n(10) usage national.
- An alphanumeric host variable that has an explicit FOR BIT DATA declaration is set by DB2 to CCSID 66535,
which indicates that the variable does not represent encoded
characters. For example:
EXEC SQL DECLARE hostvariable VARIABLE FOR BIT DATA END-EXEC
- A BLOB, BINARY, or VARBINARY host variable has no CCSID
association. These string types do not represent encoded
characters.
- A host variable for which you specify an explicit CCSID
override in the SQLDA is processed with that CCSID.
- A host variable that you specify in a declaration with
an explicit CCSID is processed with that CCSID. For example:
EXEC SQL DECLARE hostvariable VARIABLE CCSID nnnnn END-EXEC
- An alphanumeric host variable, if the SQLCCSID compiler option is in effect, is processed with
the CCSID nnnnn from the CODEPAGE compiler option.
- A DBCS host variable, if the SQLCCSID option is in effect, is processed with the mapped
value mmmmm, which is the pure DBCS CCSID component of the
mixed (MBCS) CCSID nnnnn from the CODEPAGE(nnnnn) compiler option.
- An alphanumeric or DBCS host variable, if the NOSQLCCSID option is in effect, is processed with the
CCSID from the DB2 ENCODING bind option, if specified, or from the
APPLICATION ENCODING set in DSNHDECP through the DB2 installation
panel DSNTIPF.