You can terminate parsing immediately, without processing any remaining XML document text, by setting XML-CODE to -1 in your processing procedure before returning to the parser from any normal XML event (that is, any event other than EXCEPTION). You can use this technique when you have seen enough of the document or have detected some irregularity in the document that precludes further meaningful processing.
In this case, the parser does not signal any further events, including the XML exception event. Control transfers to the ON EXCEPTION phrase of the XML PARSE statement, if specified. In the imperative statement of the ON EXCEPTION phrase, you can test whether XML-CODE is -1, which indicates that you terminated parsing deliberately. If you do not specify an ON EXCEPTION phrase, control transfers to the end of the XML PARSE statement.
When the XMLPARSE(COMPAT) option is in effect, you can also terminate parsing after any XML EXCEPTION event by returning to the parser without changing XML-CODE. The result is similar to the result of deliberate termination except that the parser returns to the XML PARSE statement with XML-CODE containing the original exception code.
When the XMLPARSE(XMLSS) option is in effect, parsing always terminates after any exception event.
related concepts
XML-CODE
How the XML parser handles errors
related tasks
Handling XML PARSE exceptions
related references
XML-CODE (Enterprise COBOL Language Reference)