COBOL and Db2 CCSID determination
All Db2® string data other than BLOB, BINARY, and VARBINARY data has an associated encoding scheme and a coded character set ID (CCSID). This is true for fixed-length and variable-length character strings, fixed-length and variable-length graphic character strings, CLOB host variables, and DBCLOB host variables.
When you use the integrated Db2 coprocessor, the determination of the code
page CCSID that will be associated with the string host variables
used in SQL statement processing depends on the setting of the COBOL SQLCCSID
option,
on the programming techniques used, and on various Db2 configuration options.
When you use the SQL
and SQLCCSID
COBOL
compiler options, the CCSID value nnnnn that is
specified in the CODEPAGE
compiler option, or that
is determined from the COBOL data type of a host variable, is communicated
automatically from COBOL to Db2. Db2 associates the COBOL CCSID with
host variables, overriding the CCSID that would otherwise be implied
by Db2 external mechanisms and
defaults. This associated CCSID is used for the processing of the
SQL statements that reference host variables.
When you use the SQL
and NOSQLCCSID
compiler
options, the CCSID value nnnnn that is specified
in the CODEPAGE
compiler option is used only for
processing COBOL statements within the COBOL program; that CCSID is
not used for the processing of SQL statements. Instead, Db2 assumes in processing SQL statements that
host variable data values are encoded according to the CCSID or CCSIDs
that are specified through Db2 external
mechanisms and defaults.
Code-page determination for string host variables in SQL statements
CODEPAGE
SQL
SQLCCSID