ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

RPGLE program for built an XML file

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

  • RPGLE program for built an XML file

    Hi guys, can anyone please give me an example with a RPGLE program for building an XML file directly on AS400?
    I will have to do this thing but I never made since now, I don't know if it is possible to make XML file directly to AS400, the request is to build an XML file with some informations and then send the XML file to another server. The solution I guess it is possible to work is to make a program who reads the necessary files and build an output file (it will be a physical file on AS400) with one field or flat file and put the tags for XML file, something like that, to have the necessary structure for XML file and then I can make the FTP to transfer the file and I assume that on the second server it will goes well and it will recognize as XML, this is the solution that I think I can make, with physical file build with tags and after transferred.
    If exist a possibility to make directly XML and not hard-coding the tags into a flat file by program please help me with a small example.

    L.E. I'm not allowed to install open source software on my IBM i, I have to develop a program to make XML file and do not use some tools for this, CGIDEV or other, my version of OS is V7R1, I found some information that I can make with SQL this thing on V7R1?

  • #2
    Re: RPGLE program for built an XML file

    Scott Klement's site has an example, but the tags are hard coded. http://www.scottklement.com/presenta...ee%20Tools.pdf

    You didn't say what IBM i release level you are on- IBM has recently added capabilities to write XML using SQL http://www.itjungle.com/fhg/fhg080812-story02.html

    There are commercial vendors that would be happy to sell you IBM i products that will help you write XML files.

    If you are allowed to install open source software on your IBM i, either HTTPAPI, powerEXT or xmlilib (a project on Sourceforge) could be free options.

    Comment


    • #3
      Re: RPGLE program for built an XML file

      Thanks for answer Jack, my version of os is 7.1 but I'm not allowed to install some products on this system unfortunately, I have to do something by me and this is a new thing regarding XML and all this stuff, I will have a look on the example that you gave me with tags hard coded.

      Comment


      • #4
        Re: RPGLE program for built an XML file

        I've written a couple of articles on this topic and also wrote part of the XML section of the new Modernization Redbook ( http://www.redbooks.ibm.com/abstracts/sg248185.html )

        The articles which cover some of the same ground can be found here: http://www.ibmsystemsmag.com/ibmi/de...enerating-XML/ and here: http://www.ibmsystemsmag.com/ibmi/developer/rpg/xmli/

        Comment


        • #5
          Re: RPGLE program for built an XML file

          Check out the link pasted below. It is generating XML using built in SQL. Since you can't install XMLi this might work for you. I am big fan of XMLi, but this seems like it might be cool too.

          Comment


          • #6
            Re: RPGLE program for built an XML file

            If I posted an example for you, wouldn't that example technically be open source? I mean, my example would be source code given to you for free on the Internet, and therefore would technically be open source, right?

            Here are some ideas for you, though:
            • Don't write XML to a physical file. The record-oriented nature of a PF is not good for XML. It's much simpler and more elegant to write to a stream file.
            • SQL has XML capabilities built-in. You could try those.
            • It's not hard to write XML without any special tools, just string together the tags... not hard at all.
            • Tools like CGIDEV2 only make things a little bit easier, not really much easier... but are kinda nice.
            • IBM provides a free XML toolkit that could use. They don't give you the source code, so probably would be allowed...
            • There are many commercial tools out there that also could be used.


            There are probably several thousand possible ways to what you want. It's a very common requirement to write XML.

            Comment


            • #7
              Re: RPGLE program for built an XML file

              Thanks Scott Klement, I will try some way to make this, before I never worked since now with stream file (I'm very newbie) and the solution for the moment is to use a physical file and to write the tags into this file but I will looking and read how can I make with stream file.

              Comment


              • #8
                Re: RPGLE program for built an XML file

                Thanks guys, it works well! I made a program for test it if it work, finally I used Q2CLE procedures in the program for create and open a stream file directly to IFS and after that I build the XML with the specific tags from my xml structure and I will make the ftp directly from IFS in a directory, seems to work well.

                Comment

                Working...
                X