sponsored links

Collapse

Announcement

Collapse
No announcement yet.

XML into data structure ...

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML into data structure ...

    Would someone help me out with the data strucutre for XML-INTO?

    I'm specifically interested in the item process Token -- but All the properties would be nice to have.

    Tried a couple routes on the datastructure and continue to receive a lame 302 error


    Thank you in advance for the help!!



    PHP Code:
    <System-Link version="1.0" hostVersion="1.0">
    <
    LoginResponse actionSucceeded="true">
    <
    SessionHandle value="-2e65cdcf:16d0071583a:-7a76"></SessionHandle>
    </
    LoginResponse>
    <
    Response sessionHandle="-2e65cdcf:16d0071583a:-7a76" workHandle="-2e65cdcf:16d0071583a:-7a75" systemTimestamp="2019-09-05 15:23:12.361" systemTimeZoneOffset="-5:00" hasErrors="false" hasWarnings="false">
    <
    QueryObjectResponse name="queryObject_ItemProcess_Default" requestedDomainClass="com.mapics.epdm.ItemProcess" actionSucceeded="true">
    <
    DomainEntity domainClass="com.mapics.epdm.ItemProcess">
    <
    Key>
    <
    Property path="site">
    <
    Value>RBS</Value>
    </
    Property>
    <
    Property path="item">
    <
    Value>R10-2'A1</Value>
    </Property>
    <Property path="revision">
    <Value>---</Value>
    </Property>
    <Property path="itemProcessToken">
    <Value>1190905141452F0002874F0705172F</Value>
    </Property>
    </Key>
    <Property path="itemProcessToken">
    <Value>1190905141452F0002874F0705172F</Value>
    </Property>
    </DomainEntity>
    </QueryObjectResponse>
    </Response>
    </System-Link> 
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  • #2
    Hmmm, that's a good one! I'm not used to having to look "inside" like that. Check out this blog: https://yusy4code.blogspot.com/2017/...using-xml.html

    Halfway down the page he looks for customer.id

    REST isn't available?
    Last edited by mjhaston; 2 weeks ago.
    Your friends list is empty!

    Comment


    • #3
      Thanks --- I will check out link -- No to REST its INFOR XA.


      Just posting the system link command used to pull the item process token:
      PHP Code:
      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE System-Link SYSTEM 'SystemLinkRequest.dtd'>
      <System-Link>
           <Login userId='&%userid%&' password='&%password%&' maxIdle='900000'
                properties='com.mapics.cas.domain.EnvironmentId=MM,
                     com.mapics.cas.domain.SystemName=as400.rbs.com,
                     com.mapics.cas.user.LanguageId=en'/>
           <Request sessionHandle='&%sessionHandle%&' workHandle='*new'
                broker='EJB' maxIdle='1000'>
      <Request sessionHandle='&%sessionHandle%&' workHandle='*new'    broker='EJB' maxIdle='1000'>
      <QueryObject domainClass="com.mapics.epdm.ItemProcess" name="queryObject_ItemProcess_Default">
      <Pql>
      <![CDATA[SELECT itemProcessToken WHERE site ='RBS' AND item ='R10-2''A1' and revision = '---']]>
      </Pql>
      </QueryObject>
      </Request>
      </System-Link>
      Last edited by jamief; 2 weeks ago.
      All my answers were extracted from the "Big Dummy's Guide to the As400"
      and I take no responsibility for any of them.

      www.code400.com

      Comment


      • #4
        Haven't time to test it Jamie - but this should be about right. You need countprefic=count_ to get the number of property elements in Key. Lengths are arbitrary.

        Code:
               Dcl-ds System_Link  Qualified;
                  version      char(3);
                  hostVersion  char(3);
                  Dcl-ds  LoginResponse;
                     actionSucceeded  char(5);
                     Dcl-ds SessionHandle;
                        value  char(30);
                     End-Ds  SessionHandle;
                  End-ds  LoginResponse;
                  Dcl-ds  Response;
                     sessionHandle  char(30);
                     workHandle  char(30);
                     systemTimestamp  char(30);
                     systemTimeZoneOffset char(10);
                     hasErrors    char(5);
                     hasWarnings  char(5);
                     Dcl-ds  QueryObjectResponse;
                        name  char(30);
                        requestedDomainClass  char(30);
                        actionSucceeded  char(5);
                        Dcl-ds  DomainEntity;
                           domainClass  char(30);
                           Dcl-ds  Key;
                              count_Property  int(5);
                              Dcl-ds  Property  Dim(99);
                                 path  char(30);
                                 Value  char(10);
                              End-ds  Property;
                           End-ds  Key;
                           Dcl-ds  Property;
                              path  char(30);
                              Value  char(30);
                           End-Ds  Property;
                        End-ds  DomainEntity;
                     End-ds  QueryObjectResponse;
                  End-ds  Response;
               End-ds  System_Link;
        Last edited by JonBoy; 1 week ago. Reason: Edited to incorporate Scott's correction.

        Comment


        • #5
          Wondering about the "lame 302 error". Is that RNX0351 with reason code 302? If so, that error indicates that there's a CCSID issue. Adding option "ccsid=ucs2" should fix that.

          If you didn't mean RNX0351, what did you mean?

          Comment


          • #6
            Thanks for the help !! Working thru this beast.

            Lame error being:
            The XML document does not match the RPG variable; reason code 1.
            The XML parser detected error code 302.

            I know it doesn't match

            Thanks again!!
            All my answers were extracted from the "Big Dummy's Guide to the As400"
            and I take no responsibility for any of them.

            www.code400.com

            Comment


            • #7
              Jon has a typo... he has 'sessionHandl' instead of 'sessionHandle'. Otherwise, his solution seems to work fine.

              Comment


              • #8
                sorry -- just got back to this -- Did you guys get this to compile on V7R2?
                I get a bunch of errors on the data structure itself.
                Pretty cool to be able to nest data structures like this.
                1 specific error I cant seem to see away around is that there are 2 data structures named Response.

                Sorry not "super" fluent on free format data structures.
                my errors read as:
                PHP Code:

                 
                *RNF3315 20      4 The Name entry is already defined on a Definition                        
                                    Specification
                defaults to blanks.                                        
                 *
                RNF3551 20      6 END-XX is not expected.                                                  
                 *
                RNF3553 20      1 END-XX name does not match the item being endedthe name is              
                                    ignored
                .                                                                  
                 *
                RNF3556 20      6 END-XX statement missing for a group containing free-form                
                                    statements

                name entry already defined refers to both Response & sessionHandle
                dim required me to qualify
                Dcl-ds Property qualified Dim(99);


                Sorry in advance!!

                oh -- my fixed format mess:
                PHP Code:
                     d SystemLink      ds                  qualified  inz
                     d  version                       3
                     d  hostVersion                   3
                     d  LogInResponse                      likeDS
                (LogInResponse_T)
                     
                d  response                           likeDS(response_T)
                     
                d  QueryObjectResponse...
                     
                d                                     likeDS(QueryObjectResponse_T)

                     
                d LoginResponse_t...
                     
                d                 ds                  qualified inz
                     d actionSucceeded
                ...
                     
                d                               10
                     d SessionHandle                       likeDS
                (SessionHandle_t)

                     
                d SessionHandle_t...
                     
                d                 ds
                     d value                         30

                     d Response_t
                ...
                     
                d                 ds
                     d sessionHandl                  30
                     d workHandle                    30
                     d systemTimeStamp
                ...
                     
                d                               30
                     d systemTimeZoneOffset
                ...
                     
                d                               10
                     d hasErrors                     05
                     d hasWarnings                   05

                     d QueryObjectResponse_t
                ...
                     
                d                 ds                  qualified
                     d name                          30
                     d requestedDomainClass
                ...
                     
                d                               30
                     d actionSucceeded
                ...
                     
                d                               30
                     d  domainEntity                       likeDS
                (DomainEntity_T)

                     
                d DomainEntity_t...
                     
                d                 ds                    Qualified
                     d domainClass
                ...
                     
                d                               30
                     d  Key                                likeDS
                (Key_T)
                     
                d  Property                           likeDS(Property_t)

                     
                d Key_T...
                     
                d                 ds                    Qualified
                     d count_Property
                ...
                     
                d                                5i 0
                     d  Property                           likeDS
                (Property_t)  dim(99)

                     
                d Property_t...
                     
                d                 ds                     qualified
                     d Path                          30
                     d Value                         10 
                Attached Files
                Last edited by jamief; 1 week ago.
                All my answers were extracted from the "Big Dummy's Guide to the As400"
                and I take no responsibility for any of them.

                www.code400.com

                Comment


                • #9
                  Yes - it will compile on 7.2 - although I used 7.3.

                  Why did you not just use the free-form version? It is so much easier to see the "shape".

                  I just compiled your fixed form version for 7.2 Jamie and it is fine. If there are duplicates then it must be because you have a dup definition elsewhere - or are missing a PTF or three maybe ...

                  I did also fix the name error that Scott identified earlier - but that wouldn't affect anything until you tried to use the DS.
                  Last edited by JonBoy; 1 week ago. Reason: Edited to note that it compiles for 7.2

                  Comment


                  • #10
                    Jon's example compiles and works for me on 7.2

                    Your fixed-format version compiles for me, but doesn't match the document. I can make it match the document by making the following changes:

                    1. Change the name of SystemLink to System_Link
                    2. Move the QueryObjectResponse to be part of the Response_t structure. (You have it under SystemLink, which isn't where its found in the XML)
                    3. add the qualified keyword to Response_t
                    4. fix the sessionHandl typo

                    You should also consider adding the TEMPLATE keyword to any DS that's only referenced by LIKEDS. This isn't required, strictly-speaking, but it will utilize less memory, and clear up some confusion for the next developer who reads your code and wonders why you have data structures that you don't use. (TEMPLATE makes it clear that its only used as a template.)

                    After fixing these, it compiles and successfully works with the XML document for me.

                    Comment


                    • #11
                      @ John -- I did attempt to used the Free version. The attached .pdf is the compile attempt for /free DS version. I just added the fixed for reference.
                      @Scott I will follow your recommendations for the fixed version and see what happens.
                      All my answers were extracted from the "Big Dummy's Guide to the As400"
                      and I take no responsibility for any of them.

                      www.code400.com

                      Comment

                      sponsored links

                      Collapse

                      Working...
                      X