C/C++ supports UTF-16 data. C/C++ also supports UTF-32
data, but Db2 for z/OS® does not.
About this task
Db2 for z/OS, however,
supports UTF-8 and UTF-16 data.
Procedure
To process Unicode data in C/C++ applications for Db2 for z/OS:
- For UTF-16 data, use the data type char16_t and prefix
these literal values with u.
In C, char16_t is defined
inside the <uchar.h> header. In C++, char16_t is a separate
built-in type.
- For SBCS UTF-8 data (UTF-8 data that corresponds to only
the first 128 code points in Unicode), specify the ASCII compiler
option. When you specify this option, the compiler converts all data
to ISO8859-1 (CCSID 819).
Restriction: You
must have an XPLINK application to use the ASCII compiler option.
- If you are using UTF-16 data,
store your data in Db2 in UTF-16.
This format often requires more space than UTF-8. However, you gain
CPU savings in processing, because Db2 and
C/C++ are both processing in the UTF-16, and no conversions are needed.
-
Specify the appropriate CCSID for your C/C++ application source
and data according to the instructions in Specifying a CCSID for your application.