You can terminate parsing deliberately by setting XML-CODE to -1 in your processing procedure before returning to the parser from any normal XML event (that is, not an EXCEPTION event). 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 although an exception condition exists. Therefore, control returns to the ON EXCEPTION phrase 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 returns to the end of the XML PARSE statement.
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 exception number.
related concepts
How the XML parser handles errors
related tasks
Handling exceptions that the XML parser finds
related references
XML-CODE
(COBOL for Windows Language Reference)