Controlling the encoding of generated XML output
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.
About this task
If you specify the WITH
ENCODING codepage phrase to designate
the coded character set identifier (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 described in the related reference below about the encoding of
XML documents:
- If the data item that receives the generated XML is of category
national, the
WITH ENCODINGphrase must specify 1200, the CCSID for Unicode UTF-16. -
If the receiving identifier is of category alphanumeric, the
WITH ENCODINGphrase must specify CCSID 1208 or the CCSID of a supported EBCDIC code page.
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.
CODEPAGE
The encoding of XML documents
XML GENERATE statement (Enterprise COBOL for z/OS® Language Reference)
Operation of XML GENERATE (Enterprise COBOL for z/OS Language Reference)