DBCS Variable-length Character Strings

DBCS variable-length character strings are SQL data types similar to variable-length character strings, but are encoded using DBCS characters instead of single- or mixed-byte characters.

Host Variable Formats

OpenESQL and DB2 ECM
01 dbcschar1.
   49 dbcschar1-len        PIC S9(4)  COMP-5.
   49 dbcschar1-data       PIC N(200) USAGE DISPLAY-1.

01 dbcschar2.
   49 dbcschar1-len        PIC S9(4)  COMP.
   49 dbcschar1-data       PIC G(200).
  • The level number for group items containing only two elementary items must be 49. The first item is a two-byte field declared with usage COMP or COMP-5 that represents the effective length of the character string. The length field can be signed or unsigned. The second item is a PIC n DISPLAY-1 or PIC G data type, where n is an integer representing the length of the field that holds the data.
  • SQL statements must reference the group name.
OpenESQL JVM Managed Runtime
In addition to the definitions valid for OpenESQL, the following definition is also valid for the OpenESQL JVM Managed Runtime:
01 dbcschar3      string.

For more information on using host variables with international data, see OpenESQL Globalization Best Practices.