The XML-CODE special register is used for the following purposes:
The XML-CODE special register has the implicit definition:
01 XML-CODE PICTURE S9(9) USAGE BINARY VALUE 0.
When used in nested programs, this special register is implicitly defined with the global attribute in the outermost program.
When the XML parser encounters an XML event, it sets XML-CODE and then passes control to the processing procedure. For all events except an EXCEPTION event, XML-CODE contains zero when the processing procedure receives control.
For an EXCEPTION event, the parser sets XML-CODE to an exception code that indicates the nature of the exception. XML PARSE exception codes are discussed in the Enterprise COBOL Programming Guide.
You can set XML-CODE before returning to the parser, as follows:
If you set XML-CODE to any other value before returning to the parser, results are undefined.
When the parser returns control to the XML PARSE statement, XML-CODE contains the most recent value set by the processing procedure or the parser. In some cases, the parser overrides the value set by the processing procedure.
At termination of an XML GENERATE statement, XML-CODE contains either zero, indicating successful completion of XML generation, or a nonzero error code, indicating that an exception occurred during XML generation. XML GENERATE exception codes are detailed in the Enterprise COBOL Programming Guide.