COBCH1870 Cannot use XML PARSE in programs with non-standard PERFORM logic

The program contains an XML PARSE statement that uses a PERFORMTYPE other than ANSI where a non-standard PERFORM, such as a recursive PERFORM, is present. This is not allowed when compiled to JVM COBOL code.

Resolution:

Recompile for JVM COBOL code, or correct the code and recompile as before.

Example:

The following example shows XML PARSE used with recursive PERFORM logic.

      $set performtype(osvs)
       Identification division.
       Program-id. CHK0201A.
       Data division.
       Working-storage section.
       1 i1 binary-long.
       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.
           perform s1
           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
           .
       s1 section.
           add 1 to i1
           if i1 < 4
               perform s1

           .
       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         
           .