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, if it sets XML-CODE to -1).
For each event except the EXCEPTION event, the value of XML-CODE is zero. If your processing procedure sets XML-CODE to -1 before returning control to the parser for an event other than EXCEPTION, processing stops with a user-initiated COBOL exception condition.
For the EXCEPTION event, special register XML-CODE contains the exception code.
For an encoding conflict exception when XMLPARSE(COMPAT) is in effect, your processing procedure can reset XML-CODE to a valid value before returning to the parser. If you reset XML-CODE to any other nonzero value or reset it for any other exception, the parser sets XML-CODE to the original exception code.
related references
XML reference material
XML-CODE (Enterprise COBOL Language Reference)