AS/400 Physical file conversion to XML file

55 pts.
Tags:
AS/400 import/export
Physical File
RPG/400
RPGLE
XML
Hi, I need to write an RPGLE program to convert an AS/400 physical file to an XML file. Does anyone have a sample code for it? Thanks in advance.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Scott Klement wrote an open source XML parser. You can find it here: http://www.scottklement.com/expat/

Also, you may find some examples here: http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/books_web/c0925076168.htm

and here: http://www.google.com/search?hl=en&q=xml+%2Brpgle&aq=f&oq=&aqi=g1

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • RVP400
    If your xml is simple, you can also use SQL2XML. Just google it or lookup it in MCPressOnline.com, download the freeware and read the instructions. It's quite easy to use. Regards, RVP400
    270 pointsBadges:
    report
  • bernard85
    You'll find a way to generate a XML:
          // --------------------------------------------------------------------
          // Save tree as XML
          // --------------------------------------------------------------------
         pxml_tree2XML     b                   export
         d xml_tree2XML    pi
         d  xmlpath                     128a   const varying
         d  lRoot                          *   const
         d  pXX_XMLoutput                  *   const procptr
          *
         d  hXML           s             10i 0
          /free
            hXML=ifs_openforWrite(XMLpath);
            ifs_println(hXML:'<?xml version="1.0" encoding="ISO-8859-1" ?>');
            xml_tree2XML2(hXML:lRoot:pXX_XMLoutput);
            ifs_close(hXML);
          /end-free
         p                 e
    				
    380 pointsBadges:
    report
  • bernard85
    Part 2:
    pxml_tree2XML2    b
         d xml_tree2XML2   pi
         d  hXml                         10i 0
         d  lNode                          *   const
         d  pXX_XMLoutput                  *   const procptr
          *
         d xml_Node        ds                  likeDs(xml_NodeDefine)
         d lNode2          s               *
          *
         d xxx_XMLoutPut   pr                  extProc(pXX_XMLoutput)
         d                                     likeDs(xml_nodeDefine)
         d   lNode                         *   const
          /free
           xml_node=xxx_XMLoutput(lNode);
           xml_Node.isOpen=*on;
           xml_Node.isClose=tree_getFirst(lNode)=*null;
           xml_node.level=tree_getLevel(lNode);
           xml_writeNode(hXml:xml_node);
           //
           if not xml_Node.isClose;
             // Process childs                                                     -
             lNode2=tree_getFirst(lNode);
             dow lNode2<>*null;
               xml_tree2XML2(hXML:lNode2:pXX_XMLoutput);
               lNode2=tree_getNext(lNode2);
             endDo;
             xml_Node.isOpen=*off;
             xml_Node.isClose=*on;
             xml_writeNode(hXml:xml_node);
           endIf;
          /end-free
         p                 e
    
    380 pointsBadges:
    report
  • azohawk
    Craig Rutledge <www.jcrcmds.com> has some utilities also. I have not used these specific utilities, so I can't vouch for them.
    2,845 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: