COBCH1869 XML PARSE processing procedure may execute STOP RUN, GOBACK or EXIT PROGRAM

The program contains an XML PARSE statement whose processing procedure includes, STOP RUN, GOBACK or EXIT PROGRAM. These are not allowed.

Resolution:

Correct the code; then recompile.

Example:

The following example shows illegal use of STOP RUN and GOBACK.

       Identification division.
       Program-id. CHK0201A.
       Data division.
       Working-storage section.
       1 dummy-buffer pic x(100) value spaces. 
       1 xml-document.
           2 pic x(22) value '<?xml version="1.0" ?>'.
           2 pic x(39) value '<!--This document is just an example-->'.
           2 pic x(10) value '<sandwich>'.
           2 pic x(36) value '<bread type="baker's best "/>'.
           2 pic x(38) value '<?spread please use real mayonnaise ?>'.
           2 pic x(28) value '<meat>Ham &turkey</meat>'.
           2 pic x(35) value '<filling>Cheese,lettuce,tomato,etc.'.
           2 pic x(10) value '</filling>'.
           2 pic x(34) value '<![CDATA[ We should add a <relish>'.
           2 pic x(21) value 'element in future!]]>'.
           2 pic x(29) value '<listprice>$4.99 </listprice>'.
           2 pic x(25) value '<discount>0.10</discount>'.
           2 pic x(11) value '</sandwich>'.
       1 xml-document-length  pic 999.
       
       Procedure division.
       mainline section.
           XML PARSE xml-document PROCESSING PROCEDURE xml-handler
           ON EXCEPTION
              display 'XML document error ' XML-CODE
           NOT ON EXCEPTION
              display 'XML document successfully parsed'
           END-XML
           stop run.
       
       xml-handler section.
           evaluate XML-EVENT  
           when 'START-OF-ELEMENT'
                display 'Start elementtag:<' xml-text '>'
           when 'CONTENT-CHARACTERS'
                display 'Content characters:<' xml-text '>'
           when 'END-OF-ELEMENT'
                display 'End elementtag:<' xml-text '>'
           when 'START-OF-DOCUMENT'
                compute xml-document-length = function length(xml-text)
                display 'Start of document:length=' xml-document-length
           when 'END-OF-DOCUMENT'
                display 'End of document.'
           when 'VERSION-INFORMATION'
                display 'Version:<' xml-text '>'
           when 'ENCODING-DECLARATION'
                display 'Encoding:<' xml-text '>'
           when 'STANDALONE-DECLARATION'
                display 'Standalone:<' xml-text '>'
           when 'ATTRIBUTE-NAME'
                display 'Attribute name:<' xml-text '>'
           when 'ATTRIBUTE-CHARACTERS'
                display 'Attribute value characters:<' xml-text '>'
           when 'ATTRIBUTE-CHARACTER'
                display 'Attribute value character:<' xml-text '>'
           when 'START-OF-CDATA-SECTION'
                display 'Start of CData:<' xml-text '>'
           when 'END-OF-CDATA-SECTION'
                display 'End of CData:<' xml-text '>'
           when 'CONTENT-CHARACTER'
                display 'Content character:<' xml-text '>'
           when 'PROCESSING-INSTRUCTION-TARGET'
                display 'PI target:<' xml-text '>'
           when 'PROCESSING-INSTRUCTION-DATA'
                display 'PI data:<' xml-text '>'
           when 'COMMENT'
                display 'Comment:<' xml-text '>'
           when 'EXCEPTION'
               compute xml-document-length = function length (xml-text)
               display 'Exception ' XML-CODE 'at offset' 
               xml-document-length
           when other
               display 'Unexpected XML event:' XML-EVENT
           end-evaluate         
           goback
           .