Unicode Variable-length Character Strings

Unicode variable-length character strings (unichar) are SQL data types similar to variable-length character strings, but are encoded using UTF-16 characters instead of single- or mixed-byte characters.

Host Variable Formats

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

01 unichar2.
   49 unichar1-len        PIC S9(4)  COMP.
   49 unichar1-data       PIC N(200) USAGE NATIONAL.
  • The level number for group items containing only two elementary items must be 49. The first item is a four-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 PICn NATIONAL 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 definition valid for OpenESQL, the following definition is also valid for the OpenESQL JVM Managed Runtime:
01 unichar3               string.

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