When you generate XML output by using the XML GENERATE statement, you can control the encoding of the output by the category of the data item that receives the output, and by identifying the document encoding using the WITH ENCODING phrase of the XML GENERATE statement.
If you specify the WITH ENCODING codepage phrase, codepage must identify one of the code pages supported for COBOL XML processing as described in the related reference below about the encoding of XML documents. If codepage is an integer, it must be a valid CCSID number. If codepage is of class alphanumeric or national, it must identify a code-page name that is supported by the International Components for Unicode (ICU) conversion libraries as shown in the converter explorer table referenced below.
If you do not code the WITH ENCODING phrase, the generated XML output is encoded as shown in the table below.
| If you define the receiving XML identifier as: | The generated XML output is encoded in: |
|---|---|
| Native alphanumeric (CHAR(EBCDIC) is not in effect, or the data description contains the NATIVE phrase) | The ASCII or UTF-8 code page indicated by the runtime locale in effect |
| Host alphanumeric (CHAR(EBCDIC) is in effect, and the data description does not contain the NATIVE phrase) | The EBCDIC code page in effect1 |
| National | UTF-16 in big-endian format |
|
|
A byte order mark is not generated.
For details about how data items are converted to XML and how the XML element names and attributes names are formed from the COBOL data-names, see the related reference below about the operation of the XML GENERATE statement.
related tasks
Setting the locale
Setting environment variables
related references
CHAR
The encoding of XML documents
XML GENERATE statement (COBOL for AIX Language Reference)
Operation of XML GENERATE (COBOL for AIX Language Reference)
International Components for Unicode: Converter Explorer