Specifying the code page for character data

In a source program, you can use the characters that are represented in a supported code page in COBOL names, literals, and comments. At run time, you can use the characters that are represented in a supported code page in data items described with USAGE DISPLAY, USAGE DISPLAY-1, or USAGE NATIONAL.

The code page that is in effect for a particular data item depends on the following aspects:

For USAGE NATIONAL data items, the code page is always UTF-16 in big-endian format.

For USAGE DISPLAY data items, COBOL for AIX chooses between ASCII, UTF-8, EUC, and EBCDIC code pages as follows:

For USAGE DISPLAY-1 data items, COBOL for AIX chooses between ASCII and EBCDIC code pages as follows:
  • Data items that are described with the NATIVE phrase in the USAGE clause or that are compiled with the CHAR(NATIVE) option in effect are encoded in an ASCII DBCS code page.
  • Data items that are described without the NATIVE phrase in the USAGE clause and that are compiled with the CHAR(EBCDIC) option in effect are encoded in an EBCDIC DBCS code page.

COBOL determines the appropriate code page as follows:

ASCII, UTF-8, EUC
From the active locale at run time
EBCDIC
From the EBCDIC_CODEPAGE environment variable, if set, otherwise the default EBCDIC code page from the current locale setting

related references   
Locales and code pages that are supported  
Runtime environment variables
  
CHAR  
COBOL words with single-byte characters
   (COBOL for AIX Language Reference)  
User-defined words with multibyte characters
   (COBOL for AIX Language Reference)