Programming Languages on Power

Programming Languages on Power

Connect, learn, share, and engage with IBM Power.

 View Only
  • 1.  XML-INTO working great for V7R3. Compiling back to V7R2 not so much.

    Posted Fri April 19, 2024 01:42 PM

    I'm extracting command info using the QCDRCMDD API.  The API works great at either VRM.  The XML-INTO command works great at any level of the xml at V7R3, both nothing seems to work at V7R2.  I'm using ccsid(1208) for the return from the QCDRCMDD API.  I've tried many others.  I've also tried several using XML-INTO options including ccsid=UCS-2. 

    V7R2 message:
     Message ID . . . . . . :   RNX0351       Severity . . . . . . . :   50        
     Message type . . . . . :   Escape                                             
     Date sent  . . . . . . :   04/19/24      Time sent  . . . . . . :   12:31:20  
                                                                                   
     Message . . . . :   The XML parser detected error code 302.                   
     Cause . . . . . :   While parsing an XML document for an RPG procedure, the   
       parser detected an error at offset 0 with reason code 302. The actual       
       document is *N; *N indicates that the XML document was not an external file.
    Good results from V7R3 or better (tried compiling to V7R2 from V7R3 and V7R4 both with the same results).
    > EVAL cmd                                                                                                                        
      CMD.CMDNAME = 'WRKACTJOB '                                                                                                      
      CMD.CMDLIB = 'QSYS      '                                                                                                       
      CMD.PARM.KWD(1) = 'OUTPUT    '                                                                                                  
      CMD.PARM.TYPE(1) = 'CHAR      '                                                                                                 
      CMD.PARM.PROMPT(1) = 'Output                        '                                                                           
      CMD.PARM.LEN(1) = '1    '                                                                                                       
      CMD.PARM.CHOICE(1) = '*, *PRINT                     '                                                                           
      CMD.PARM.KWD(2) = 'RESET     '                                                                                                  
      CMD.PARM.TYPE(2) = 'CHAR      '                                                                                                 
      CMD.PARM.PROMPT(2) = 'Reset status statistics       '                                                                           
      CMD.PARM.LEN(2) = '1    '                                                                                                       
      CMD.PARM.CHOICE(2) = '*NO, *YES                     '                                                                           
      CMD.PARM.KWD(3) = 'SBS       '                                                                                                  
      CMD.PARM.TYPE(3) = 'NAME      '                                                                                                 
      CMD.PARM.PROMPT(3) = 'Subsystem                     '                                                                           
      CMD.PARM.LEN(3) = '10   '                                                                                                       
      CMD.PARM.CHOICE(3) = 'Name                          '                                                                           
                                                                                                                               More...
    Debug . . .                                                                                                                       


         DrtvCmdParms      pr                  extpgm('QCDRCMDD')
         D qualCmdNam                    20a   const
         D destinf                       10i 0 const
         D dstFmtNam                      8a   const
         D rcvVar                              likeds(rcvVar)
         D rcvFmtNam                      8a   const
         D errDS                               likeds(ApiError)
         D*QcdCLCmd         ds                  qualified
         D* DTDVersion                     3a
         D* cmd                                 likeds(cmdt)
         D Cmd             ds                   qualified
         D  CmdName                      10a
         D  CmdLib                       10a
         D  Parm                               likeds(parmt)
         D                                     dim(20)
         D* numParm                        5i 0
         D*
         D* Parm            ds                  qualified dim(20)
         D*  kwd                          10a
         D*  type                         10a
         D*  prompt                       30a
         D*  len                           5a
         D*  choice                       30a
         D Parmt           ds                  qualified
         D  kwd                          10a
         D  type                         10a
         D  prompt                       30a
         D  len                           5a
         D  choice                       30a
         D rcvVar          ds
         D  bytesRet                     10i 0
         D  bytesAvl                     10i 0
         D  xmlData                   32759a   ccsid(1208)  


          /free
           rtvCmdParms('WRKACTJOB QSYS      ':
                       %len(rcvVar):
                       'DEST0100':
                       rcvVar:
                       'CMDD0100':
                       apiError);
           xml-into cmd %xml(xmldata:'case=any +
                 allowextra=yes allowmissing=yes doc=string +
                 path=QcdCLCmd/Cmd'); //countprefix=num  ccsid=UCS2  


    I've tried many things, but not the right thing (if the right thing exists).



    ------------------------------
    Patrick Kelly
    ------------------------------

    #RPG


  • 2.  RE: XML-INTO working great for V7R3. Compiling back to V7R2 not so much.

    Posted Fri April 19, 2024 06:29 PM
    That problem has appeared previously - there's a thread here that may offer some thoughts https://stackoverflow.com/questions/17396023/the-xml-parser-detected-error-code-302

    Have you checked PTF levels on the two system?

    Have you compared the XML strings on both systems?

    Are the system and job CCSIDs the same on both boxes?  One on 65535 and one on (say) 37 might produce this result.


    Jon P.





  • 3.  RE: XML-INTO working great for V7R3. Compiling back to V7R2 not so much.

    Posted Sat April 20, 2024 06:38 AM

    The difference in boxes isn't the issue, it is compiling back to V7R2 where the issue pops up.  One box is at V7R3, the other at V7R4.  Compiling to V7R3 from either box works great. 

    My jobs and systems are at CCSID 37.  I did try a CHGJOB to 65534 as well is others.  I've tried various CCSIDs on the variable declaration and in the XML-INTO options. 

    I did come across that thread and a few others.  I had compared the output, but after re-reading the thread, I did compare in hex, and it's the same. Most importantly, I guess, starting with x'3C' and no junk at the end.

    I did find a way to get 'something' to work.  I isolated the xml-into input to just one parm statement and output to a non-dimensional DS, and V7R2 will output to that.  Later I'll try stripping off everything before and after the retrieved parm statements, make multidimensional and see if that works around the issue.

    V7R2:

    Thanks for the response...Oh, PTFs should all be current as of this year.  I poked around anything specific, but couldn't find anything.



    ------------------------------
    Patrick Kelly
    ------------------------------



  • 4.  RE: XML-INTO working great for V7R3. Compiling back to V7R2 not so much.
    Best Answer

    Posted Sat April 20, 2024 07:34 AM

    The problem with the first operand of %XML having CCSID 1208 was only fixed with PTFs for releases 7.3 and up. 
    https://www.ibm.com/mysupport/s/defect/aCI3p0000008ypLGAQ/dt323485?language=en_US

    The circumvention is to pass the first operand as UCS2

    ... %XML(&UCS2(xmldata) ..

    xml-into cmd %xml(%ucs2(xmldata):'case=any +              
          allowextra=yes allowmissing=yes doc=string +        
          path=QcdCLCmd/Cmd'); //countprefix=num  ccsid=UCS2  



    ------------------------------
    Barbara Morris
    ------------------------------



  • 5.  RE: XML-INTO working great for V7R3. Compiling back to V7R2 not so much.

    Posted Mon April 22, 2024 07:07 AM

    Thank you so much.  Works great.



    ------------------------------
    Patrick Kelly
    ------------------------------