Understanding Running COBOL in a z/OS Unicode Environment

This section discusses running COBOL in a z/OS Unicode environment.

See the product documentation for PeopleTools Installation for DB2 for z/OS.

The character set that you use for PeopleSoft COBOL processing must match the character set for your database. If you create a Unicode database for a PeopleSoft system, you must also run COBOL in Unicode.

Note: In this topic, the word character refers to a single character in any language, regardless of how many bytes are required to store the character.

The Unicode standard provides several methods of encoding Unicode characters into a byte stream. Each encoding has specific properties that make it suitable for use in different environments. Two main encodings that are important to understand are:

Encoding

Description

UCS-2

The Unicode encoding that PeopleSoft COBOL on z/OS Unicode environment uses.

PeopleTools uses the encoding internally for data that is held in memory on the application server.

UTF-8

The Unicode encoding that PeopleSoft systems use in COBOL running on Unix and Microsoft Windows servers.

On Unix and Microsoft Windows servers, PeopleSoft uses UTF-8 encoding to support Unicode in COBOL. PeopleSoft uses UTF-8 since it is a superset of the US-ASCII character set, which is the native character set of these operating systems. PeopleSoft can support Unicode in these environments without requiring any special support from the COBOL compiler.

However, in the z/OS environment the native character set is EBCDIC. UTF-8 is not compatible with EBCDIC, and the COBOL runtime environment on z/OS does not recognize the data in UTF-8 correctly as it expects data encoded in EBCDIC. As a result, PeopleSoft supports Unicode COBOL on z/OS by relying on the IBM Enterprise COBOL compiler’s native Unicode support, which uses UCS-2.

Moving to a z/OS COBOL Unicode environment means that character data in COBOL programs, including numbers, dates and time, is stored and processed in the UCS-2 encoding of Unicode. IBM Enterprise COBOL uses special usage NATIONAL to store Unicode data, instead of usage DISPLAY.

The usage NATIONAL should be used for all storage and literal declarations, except for limited special cases. PeopleSoft has worked with IBM to ensure that all the statements that process string data can work with data fields declared with usage NATIONAL.

The PeopleSoft system provides a COBOL Unicode conversion utility for z/OS that automatically converts the data field usage for Unicode storage. When the file server is installed with the “Unicode database” option selected, the conversion utility runs behind the server transfer process, and JCL files pre-configured for compiling Unicode COBOL programs are copied to the server. The Unicode support is provided out-of-the box, with no additional configuration required.

Unlike Unicode COBOL on Unix and Microsoft Windows, there is no need to explicitly expand storage size for Unicode processing in the z/OS Unicode environment. To store ten characters on DB2 UDB for OS/390 and z/OS, declare the database column as VARGRAPHIC(10). This column can be fetched into PIC N(10) field in Unicode COBOL programs running on z/OS.

Even when character data in a PeopleSoft z/OS COBOL program is stored and processed internally in Unicode, there are some cases where data is needed in a native non-Unicode character set of the system. This is especially true for the purpose of input and output operations, and because external systems may not fully support Unicode.

Database Input/Output

PeopleSoft uses COBOL mainly for high-performance SQL batch jobs. DB2 UDB for OS/390 and z/OS supports communication with COBOL programs in Unicode using GRAPHIC and VARGRAPHIC data types.

All PeopleSoft-delivered COBOL programs are designed to communicate through the single central database access program PTPSQLRT. This program is enhanced to support communication with databases using Unicode.

Note: You may need to manually modify custom COBOL programs if they do not use PTPSQLRT or PTPDYSQL for database communication. The PeopleSoft-provided COBOL Unicode conversion utility for z/OS does not update SQL communication logic automatically.

Logging

PeopleSoft COBOL programs output logs using DISPLAY statements. The logs are mainly for displaying informational and debug messages. As these may need to be displayed on z/OS terminal screens which cannot display Unicode data, the PeopleSoft COBOL Unicode conversion utility inserts the DISPLAY-OF() COBOL intrinsic function to convert data to the system EBCDIC character set in the context of the DISPLAY statement.

Note: Because logs are generated in the system EBCDIC code page, not all the Unicode characters display on the log file. Characters not included in the system code page will be lost. Do not attempt to display international characters on the COBOL log. For reporting purpose, use the Structured Query Report (SQR) language instead of COBOL.

File Processing

A small number of PeopleTools COBOL programs use file input/output using READ and WRITE statements, for parameter input from JCL or writing logs. As these input/output can be better done using the system EBCDIC character set rather than Unicode, the PeopleTools COBOL programs performing file input/output are updated to convert to and from EBCDIC when accessing files. Because of the very limited use of file input/output, the COBOL Unicode conversion utility does not perform any special work for file input/output.

Note: Use Application Engine for processes that involve file input and output.

Miscellaneous Input/Output Operations

There are other cases where you should use the EBCDIC character set for string data, such as when accessing environment variables. PeopleSoft delivered programs are modified to convert internal Unicode representation of strings just before passing it to external data area, or convert from EBCDIC to internal Unicode representation, when required. However, the COBOL source conversion utility will not automatically update them. If you have custom COBOL programs that access external data, you may need to test them thoroughly after running the conversion utility, and insert DISPLAY-OF() or NATIONAL-OF() COBOL intrinsic functions where data conversions are required.