XML-CODE

The XML-CODE special register is used to communicate status between the XML parser and the processing procedure that was identified in an XML PARSE statement, and to indicate either that an XML GENERATE statement executed successfully or that an exception occurred during XML generation.

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 Handling XML PARSE exceptions in the Enterprise COBOL Programming Guide.

For some XML events, you can set XML-CODE before returning to the parser to control subsequent processing of the document. For details, see XML-CODE in the Enterprise COBOL Programming Guide.

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 XML GENERATE exceptions in the Enterprise COBOL Programming Guide.

Related concepts
XML-CODE (Enterprise COBOL Programming Guide)

Related tasks  
Handling XML PARSE exceptions (Enterprise COBOL Programming Guide)

Related references  
XML GENERATE exceptions (Enterprise COBOL Programming Guide)