When the parser returns control to your XML PARSE statement, special register XML-CODE contains the most recent value that was set by the parser or by your processing procedure.
For each event except the EXCEPTION event, the value of XML-CODE is zero. If you set XML-CODE to -1 before you return control to the XML parser for an event other than EXCEPTION, processing stops with a user-initiated exception (as indicated by the returned XML-CODE value of -1). The result of changing XML-CODE to any other nonzero value before returning from any event is undefined.
For the EXCEPTION event, special register XML-CODE contains the exception code.
The
following figure shows the flow of control between the parser and your
processing procedure and shows how XML-CODE is used to pass information
between them. The off-page connectors (for example,
)
connect the multiple charts in this information. In particular,
in the following figure connects to the chart Control flow for XML exceptions, and
connects from XML CCSID exception flow control.
Control flow between XML parser and program, showing XML-CODE usage

related concepts
The content of XML-TEXT and XML-NTEXT
related tasks
Writing procedures to process XML
Handling exceptions that the XML parser finds
related references
Appendix F. XML reference material
XML-CODE
(COBOL for Windows Language Reference)