Processing Unicode data in PL/I applications

PL/I and Db2 for z/OS® support UTF-16 and UTF-8 data.

Procedure

To process Unicode data in PL/I applications for Db2 for z/OS, consider the following recommended actions.

  • Use the WIDECHAR data type. This data type supports UTF-16 data in PL/I.

    Start of changeAlthough PL/I supports UTF-8 data, you can still use a PL/I application to retrieve UTF-8 data from Db2 into a WIDECHAR variable. For example, if you retrieve data from the Db2 catalog, and the host variable has data type WIDECHAR, Db2 converts the Unicode data for the PL/I application from UTF-8 to UTF-16. End of change

  • Use UTF-16 for your Unicode data in your PL/I application and store your application Unicode data in Db2 in UTF-16. This format often requires more space than UTF-8. However, you might gain CPU savings in processing because Db2 and PL/I are both using UTF-16, and no conversions are needed. For additional Db2 CCSID resolution during bind processing and to achieve optimal performance, refer to Character conversion.
  • Prepare your application with the Db2 coprocessor.
  • Specify the appropriate CCSID for your PL/I application source and data.
  • Ensure that your ENCODING bind option matches the data. Depending on the situation, you might consider the other options that are described in Specifying a CCSID for your application.