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 code page using the WITH ENCODING phrase of the XML GENERATE statement.
If you specify the WITH ENCODING codepage phrase to designate the coded character set identifer (CCSID) of the output document, codepage must specify an unsigned integer data item or unsigned integer literal that identifies one of the code pages supported for COBOL XML processing as shown in the related reference below about coded character sets for XML documents:
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: |
|---|---|
| Alphanumeric | The code page specified by the CODEPAGE compiler option in effect when the source was compiled |
| National | UTF-16 big-endian (UTF-16BE, CCSID 1200) |
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 references
CODEPAGE
Coded character sets for XML documents
Operation of XML GENERATE (Enterprise COBOL Language Reference)