[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: XMl parsing using XML-Into opcode on V5R4



       Jon/Wouter,

         Thank you for taking a time to answer my question.  I'm able to make xml-into work but now I'm getting 65535 characters limit error message because I am using multiple dimensional data structures in the single data structure based on the xml coming from the third party. I did research over the internet and found the following:

       "The RPG compiler limits character variables to 65535 characters in length. Data Structures, being considered character fields, are subject to this length limitation as well. You must be aware when replicating the XML tree using data structures, especially data structures that are dimensional, that the total size of the data structure tree does not exceed this limit as well. Work around for this limitation:- break apart the data structures without nesting them inside each other and use multiple XML-INTO operations to decompose specifying the specific path of the XML document that matches the data structure names.".

       Is there any way else to make this happen other than using multiple XML-INTOs? I just want to make sure that I'm making a right approach to handle this issue. Herewith, I'm providing a high level tree structure of the XML.



        <freightbill SingleShipment="false">
         <freightbillaccessorials/>
         <freightbillcommodities/>
         <freightbillratingdetails />
         <freightbillmileagecalculations />
         <freightbillpricingdisqualifys />
         <freightbillratingerrors />
         <freightbillstops />
         <freightbilluomunits />
         <freightbillconstraints />
         <freightbilluierrors/>
        </freightbill>


       Now, no longer I can use only 1 XML-into statement since I'm reaching a max limit of variable.

       xml-into freightbill

                  %XML(xmldata : 'case=any allowextra=yes +

                                     allowmissing=yes');


       Instead, I have to use xml-into statement for each elements.


       xml-into freightbillaccessorials.freightbillaccessorial

                  %XML(xmldata : 'case=any allowextra=yes +

                                  allowmissing=yes path=freightbill/+

             freightbillaccessorials / freightbillaccessorial');


          xml-into freightbillcommodities.freightbillcommodity

                  %XML(xmldata : 'case=any allowextra=yes +

                                  allowmissing=yes path=freightbill/+

             freightbillcommodities/freightbillcommodity');



       Thank you Scott for providing many open source tools especially http_apis.


       Nilesh


       -----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Tuesday, July 14, 2009 6:49 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: XMl parsing using XML-Into opcode on V5R4

       The only real changes I made to your code were to remove the Dim from
       freightbillcommodity - from the document you sent it is not repeating
       - but I don't see that that was the problem.  The RPG code you posted
       did an XML-INTO freightbill - but I can't see any definition for that
       so I have to assume the source you sent was incomplete because as-is
       it won't compile.

       I added the definition for freightbill based on what I found in the
       XML (guessing the field sizes) and changed the XML-INTO to reference a
       file - you were referencing a variable - which again was not shown in
       the sample you supplied - so it is possible that there was an error in
       the XML that caused the problems - I can't tell.

       Anyway - this version works and I can see the content of all data
       elements in debug.

             D freightbill     Ds                  Qualified
             D  id                            1a
             D  Clientcode                   20a
             D  carriercode                  20a
             D  freightbillcommodities...
             D
       LikeDS(freightbillcommodities_t)

             D freightbillcommodities_t...
             D                 Ds                  Qualified

             D freightbillcommodity...
             D                                     likeds(FrBlComm_t) dim(2)

             D FrBlComm_t      Ds                  Qualified
             D  id                            5
             D  LineNumber                    5
             D  Description                  50
             D  Code                          5
             D  Commodityid                   5
             D  FBClass                       5
             D  Weight                        5
             D  Pieces                        5

              // D UIErrorsColl                        likeds(FrBlUIerr_t)
       dim(2)
             D UIErrorsColl                        likeds(FrBlUIerr_t)

             D FrBlUIerr_t     Ds                  Qualified
             D  CtlError                           Likeds(FrBiErrd) dim(2)

             D FrBiErrd        Ds                  Qualified
             D  ErrorCode                     5
             D  Source                        5
             D  ErrorMessage                 15
             D  ExtraMessage                 15
             D  Fatal                         5
              /free

               xml-into freightbill
                     %XML('/Partner400/xmldata.xml' : 'case=any
       allowextra=yes +
                                     allowmissing=yes');


       Jon Paris

       www.Partner400.com
       www.SystemiDeveloper.com



       On 13-Jul-09, at 4:00 PM, Nilesh Jokhakar wrote:

       >
       >   I'm trying to use XML-into opcode on V5R4 machine and having a hard
       >   time in getting data in the data structure. Could anyone please shed
       >   some light on the issue? The xml-into works fine upto "
       >   freightbillcommodities. Freightbillcommodity"  array but can't get
       >   remaining errors information in the data structure.
       >
       >
       >
       >   XML variable (xmldata) :
       >
       >
       >   <freightbill
       >
       >    id = "0" Clientcode = "Sample" carriercode = "samplecar">
       >
       >
       >   <freightbillcommodities>
       >
       >
       >   <freightbillcommodity id="0" LineNumber="1" Description="IRON OR
       >   STEEL" Code="19160.10000000" Commodityid="0" FBClass="100"
       >   Weight="15000" Pieces="0">
       >
       >
       >      <UIErrorsColl>
       >
       >       <CTLError>
       >
       >         <ErrorCode>FBVal</ErrorCode>
       >
       >         <Source>Commodity</Source>
       >
       >         <ErrorMessage>Unable to load commodity by code</ErrorMessage>
       >
       >         <ExtraMessage>19160.10000000</ExtraMessage>
       >
       >         <Fatal>true</Fatal>
       >
       >       </CTLError>
       >
       >
       >       <CTLError>
       >
       >         <ErrorCode>FBVal</ErrorCode>
       >
       >         <Source>Commodity</Source>
       >
       >         <ErrorMessage>Unable to load commodity by code</ErrorMessage>
       >
       >         <ExtraMessage>19160.10000000</ExtraMessage>
       >
       >         <Fatal>true</Fatal>
       >
       >       </CTLError>
       >
       >
       >      </UIErrorsColl>
       >
       >
       >   </freightbillcommodity>
       >
       >
       >   <freightbillcommodity id="1" LineNumber="2" Description="Hazmat
       >   Products" Code="20000.20000000" Commodityid="0" FBClass="100"
       >   Weight="15000" Pieces="0">
       >
       >
       >      <UIErrorsColl>
       >
       >       <CTLError>
       >
       >         <ErrorCode>FBVal</ErrorCode>
       >
       >         <Source>Commodity</Source>
       >
       >         <ErrorMessage>Unable to load commodity by code</ErrorMessage>
       >
       >         <ExtraMessage>20000.20000000</ExtraMessage>
       >
       >         <Fatal>true</Fatal>
       >
       >       </CTLError>
       >
       >
       >       <CTLError>
       >
       >         <ErrorCode>FBVal</ErrorCode>
       >
       >         <Source>Commodity</Source>
       >
       >         <ErrorMessage>Unable to load commodity by code</ErrorMessage>
       >
       >         <ExtraMessage>20000.20000000</ExtraMessage>
       >
       >         <Fatal>true</Fatal>
       >
       >       </CTLError>
       >
       >
       >      </UIErrorsColl>
       >
       >
       >   </freightbillcommodity>
       >
       >
       >   </freightbillcommodities>
       >
       >   </freightbill>
       >
       >
       >
       >   RPG program
       >
       >
       >   D freightbillcommodities...
       >
       >   D                                             Ds
       >   Qualified
       >
       >   D freightbillcommodity...
       >
       >   D                                     likeds(FrBlComm_t) dim(2)
       >
       >
       >
       >   D FrBlComm_t      Ds                  Qualified
       >
       >   D id                             5
       >
       >   D LineNumber                     5
       >
       >   D Description                   50
       >
       >   D Code                           5
       >
       >   D Commodityid                    5
       >
       >   D FBClass                        5
       >
       >   D Weight                         5
       >
       >   D Pieces                         5
       >
       >   D UIErrorsColl                        likeds(FrBlUIerr_t) dim(2)
       >
       >
       >
       >   D FrBlUIerr_t     Ds                  Qualified
       >
       >   D CtlError                            Likeds(FrBiErrd) dim(2)
       >
       >
       >
       >   D FrBiErrd        Ds                  Qualified
       >
       >   D ErrorCode                      5
       >
       >   D Source                         5
       >
       >   D ErrorMessage                  15
       >
       >   D ExtraMessage                  15
       >
       >   D Fatal                          5
       >
       >
       >   xml-into freightbill
       >
       >           %XML(xmldata : 'case=any allowextra=yes +
       >
       >                              allowmissing=yes');
       >
       >
       >   xml-into freightbillcommodities.freightbillcommodity
       >
       >           %XML(xmldata : 'case=any allowextra=yes +
       >
       >                           allowmissing=yes path=freightbill/+
       >
       >      freightbillcommodities/freightbillcommodity');
       >
       >
       >
       >   Debug version
       >
       >
       >   EVAL
       >   freightbillcommodities
       >
       >   FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.ID(1) = '0
       >   '
       >
       >   FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.LINENUMBER(1) = '1
       >   '
       >
       >   FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.DESCRIPTION(1)
       >   =
       >
       >            'IRON OR STEEL, SEE NOTE, ITEM 19162: WEIGHING
       >   '
       >
       >   FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.CODE(1) =
       >   '19160'
       >
       >   FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.COMMODITYID(1) = '0
       >   '
       >
       >   FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.FBCLASS(1) = '100
       >   '
       >
       >   FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.WEIGHT(1) =
       >   '15000'
       >
       >   FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.PIECES(1) = '0
       >   '
       >
       >
       > FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.UIERRORSCOLL.CTLERROR.ERRO
       >   RCODE(1,1,1) =
       >
       >            '
       >   '
       >
       >
       > FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.UIERRORSCOLL.CTLERROR.SOUR
       >   CE(1,1,1) =
       >
       >            '
       >   '
       >
       >
       > FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.UIERRORSCOLL.CTLERROR.ERRO
       >   RMESSAGE(1,1,1) =
       >
       >            '
       >   '
       >
       >
       > FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.UIERRORSCOLL.CTLERROR.EXTR
       >   AMESSAGE(1,1,1) =
       >
       >            '
       >   '
       >
       >
       > FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.UIERRORSCOLL.CTLERROR.FATA
       >   L(1,1,1) =
       >
       >            '     '
       >
       >
       > FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.UIERRORSCOLL.CTLERROR.ERRO
       >   RCODE(1,1,2) =
       >
       >            '
       >   '
       >
       >
       > FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.UIERRORSCOLL.CTLERROR.SOUR
       >   CE(1,1,2) =
       >
       >            '
       >   '
       >
       >
       > FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.UIERRORSCOLL.CTLERROR.ERRO
       >   RMESSAGE(1,1,2) =
       >
       >            '
       >   '
       >
       >
       > FREIGHTBILLCOMMODITIES.FREIGHTBILLCOMMODITY.UIERRORSCOLL.CTLERROR.EXTR
       >   AMESSAGE(1,1,2) =
       >
       >            '               '
       >
       >   LCOMMODITIES.FREIGHTBILLCOMMODITY.UIERRORSCOLL.CTLERROR.FATAL(1,1,2)
       >   =
       >
       >
       >   '
       > -----------------------------------------------------------------------
       > This is the FTPAPI mailing list.  To unsubscribe, please go to:
       > http://www.scottklement.com/mailman/listinfo/ftpapi
       > -----------------------------------------------------------------------

       -----------------------------------------------------------------------
       This is the FTPAPI mailing list.  To unsubscribe, please go to:
       http://www.scottklement.com/mailman/listinfo/ftpapi
       -----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------