COBOL

COBOL

COBOL

COBOL is responsible for the efficient, reliable, secure, and unseen day-to-day operations of the world's economy.

 View Only
Expand all | Collapse all

XML Generate Compile Error when using TYPE of

  • 1.  XML Generate Compile Error when using TYPE of

    Posted Fri June 24, 2016 01:14 PM

    Hi,

     

    First time posting a question. I have a COBOL DB2 program compile error on the following XML Generate statement. 

    XML GENERATE WS-XML-DOC-T FROM trade

    With XML-DECLARATION

    NAMESPACE 'http://www.xxxxxx.com/xyz/trade'

    NAMESPACE-PREFIX 'TRD'

    NAME OF Qtype IS 'TYPE'

    TYPE OF Qtype IS ATTRIBUTE

    TYPE OF Qcontent IS CONTENT

    ON EXCEPTION

    DISPLAY XML-CODE

    DISPLAY '************************************

    DISPLAY ' ERROR IN GENERATING XML !!!!

    DISPLAY '************************************

    DISPLAY WS-XML-DOC-T

    NOT ON EXCEPTION

    DISPLAY 'XML GENERATED OK '

    END-XML.

     

    Trade definition in W-S:

    01 Trade.

    05 Segmnt1.

    10 SegmentNumber PIC 999.

    10 TotalSegments PIC 999.

    ...

    15 Quantity.

    20 Qtype PIC X(13).

    20 Qcontent PIC 999,999,999.

     

    * above was cut/pasted from pgm and formatting was lost, but data is accurate.

    Using Enterprise COBOL V5.2.0

    Error: IGYPS2072-S "TYPE" was invalid. Skipped to the next verb, period or procedure-name.

    on line for "TYPE OF Qtype IS ATTRIBUTE" in source.

     

    It appears that the compiler is seeing the word "type" and getting confused. It I comment out the line, everything compile correctly and runs OK, but the desired XML tags/attributes are incorrect.

    There was a similar issue in V4.2.0 with APAR PQ62995. Not sure if this issue has already been reported and/or fixed.

     

    Any assistance would be greatly appreciated.

     

    Thanks,

    E.

     

     

     

    Chi_Guy


  • 2.  Re: XML Generate Compile Error when using TYPE of

    Posted Fri June 24, 2016 05:28 PM

    I believe you should specify TYPE OF only once, i.e.:

    NAME OF Qtype IS 'TYPE'TYPE OF Qtype IS ATTRIBUTE        Qcontent IS CONTENT


     

    fswarbrick


  • 3.  Re: XML Generate Compile Error when using TYPE of

    Posted Mon June 27, 2016 09:38 AM

    Infocat,

     

    Thank you, that worked perfectly.

     

    I feel foolish that I didn't catch that myself.

     

    Thanks again!!!

     

     

    Chi_Guy


  • 4.  Re: XML Generate Compile Error when using TYPE of

    Posted Sun June 26, 2016 05:01 AM

    The reference you give is for this: http://www-01.ibm.com/support/docview.wss?uid=swg1PQ62995.

    I think you must have typoed that.

    If you look at the syntax diagram in the Language Reference for XML GENERATE you'll see that infocat is 100% correct.

    BillWoodger