Gen EDGE

  • 1.  XML parsing in cobol

    Posted Nov 10, 2015 06:04 AM

    Does anyone has an experience in parsing XML statements inside an EAB by using the “XML PARSE” cobol compiler option?

    In fact we would like to parse an MQ message containing XML tags, extract some data which will be inserted into a DB2 table (entity).

    I found that CANAM SW has a product called “XML Composer” which might perform this task.

     



  • 2.  Re: XML parsing in cobol
    Best Answer

    Posted Nov 10, 2015 04:20 PM

    After taking a quick glance at the Google interwebbys, it seems like you don't really need to use the XMLPARSE compiler option for newly created parsing code, especially since it does not exist in COBOL 5.x (IBM New support for XMLPARSE and VLR compiler option In COBOL V5.1 - United States))

     

    Canam's XML Composer product might be useful for creating EABs that do XML parsing but you can also do it yourself (if you have Gen 8.5) using the the new INLINE CODE statement and putting your XML parsing statements directly in your action diagrams.



  • 3.  Re: XML parsing in cobol

    Posted Nov 19, 2015 03:45 AM

    We have some Cobol code using XML PARSE and XML GENERATE. We use Cobol 5.1.1 and the compiler option "XMLPARSE(XMLSS)" (I think it is the default). This option is used in Cobol 4.2 as well.

     

    Have a look in Cobol Laguage Reference and Programming Guide http://www-01.ibm.com/support/docview.wss?uid=swg27036733 on how to use XML PARSE



  • 4.  Re: XML parsing in cobol

    Posted Nov 19, 2015 09:21 AM

    Canam Software’s XML Composer product is designed specifically for this purpose.  It will generate all of the EAB code needed to validate, parse and create XML documents.  An advantage that it has over the XMLPARSE statement is that in addition to parsing, it will also populate your Gen views with the parsed results.  With XMLPARSE, you will need to develop logic to respond to the events raised by the parser (e.g. “element found”, “attribute found”, etc.) and then move the content to the appropriate Gen attribute view.  This requires maintaining context within the document which increases in complexity as you deal with optional nodes and repeating structures (and nested repeating structures).  In addition, if there are changes to the XML layout in the future, you will need to rework this logic.

    If you would like more information about XML Composer please contact me at russell@canamsoftware.com.



  • 5.  Re: XML parsing in cobol

    Posted Nov 27, 2015 04:12 PM

    I think I may have replied incorrectly with my previous post. I apologize if this is going out a second time.

     

    Canam Software’s XML Composer product is designed specifically for this purpose.  It will generate all of the EAB code needed to validate, parse and create XML documents.  An advantage that it has over the XMLPARSE statement is that in addition to parsing, it will also populate your Gen views with the parsed results.  With XMLPARSE, you will need to develop logic to respond to the events raised by the parser (e.g. “element found”, “attribute found”, etc.) and then move the content to the appropriate Gen attribute view.  This requires maintaining context within the document which increases in complexity as you deal with optional nodes and repeating structures (and nested repeating structures).  In addition, if there are changes to the XML layout in the future, you will need to rework this logic.

    If you would like more information about XML Composer please contact me at russell@canamsoftware.com.