Producing XML output
You can produce XML output from a COBOL program by using
the XML GENERATE
statement.
About this task
In
the
XML GENERATE
statement, you identify the source
and the output data items. You can optionally also identify: - A field to receive a count of the XML characters generated
- A code page in which the generated XML document is to be encoded
- A namespace for the generated document
- A namespace prefix to qualify the start and end tag of each element, if you specify a namespace
- A user-defined element or attribute name in the generated XML document
- Attributes or elements to be suppressed according to some specified conditions
- Particular items to be specified as attributes, elements or content in the generated XML output.
- A statement to receive control if an exception occurs
Optionally, you can generate an XML declaration for the document, and can cause eligible source data items to be expressed as attributes in the output rather than as elements.
You can
use the XML-CODE
special register to determine the
status of XML generation.
After you transform COBOL data items to XML, you can use the resulting XML output in various ways, such as deploying it in a web service, passing it as a message to WebSphere® MQ, or transmitting it for subsequent conversion to a CICS® communication area.
Link-edit considerations: COBOL
programs that contain the XML GENERATE
statement
must be link-edited with AMODE 31
.
Related tasks
Generating XML output
Controlling the encoding of generated XML output
Handling XML GENERATE exceptions
Enhancing XML output
Generating XML output
Controlling the encoding of generated XML output
Handling XML GENERATE exceptions
Enhancing XML output
Related references
Extensible Markup Language (XML)
XML GENERATE statement (Enterprise COBOL for z/OS® Language Reference)
Extensible Markup Language (XML)
XML GENERATE statement (Enterprise COBOL for z/OS® Language Reference)