Creating XML from RPG data

15 pts.
Tags:
RPG
XML
I am an RPG programmer and need to create XML files from our 400 data. I would love any DETAILED tips from anyone as I have no experience with this. Thank you in advance for your time!
ASKED: April 5, 2005  5:57 PM
UPDATED: April 8, 2005  3:47 AM

Answer Wiki

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

While others will probably cringe at what I suggest, we had the same requirement. Since the file we needed to create was fairly straight forward and the packages that create XML for you automagically were a little pricy, we just wrote the XML statements to a database file using nothing but RPG and then exported the database file out of the 400. It was pretty simple to do and it did not cost us any money to accomplish it.

Discuss This Question: 6  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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Timallard
    Haven't tried dbarnett's method but for almost any language the place to start is to define the schema including node names, attributes and map where values are coming from. Create a root xml document you can add nodes to. Haven't used RPG in ages so don't know how you create a xml DOM to use programmatically but in most languages you open the xml from code to create it, then, extract a line of data and add the node and set the value and attributes in a loop through the source file closing/saving the xml at the end. Pretty straightforward coding in most cases once you define the schema.
    0 pointsBadges:
    report
  • Mcp111
    Check out this link http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,295199,sid63_gci1053229,00.html
    0 pointsBadges:
    report
  • Baardbasma
    I haven't tried this method myself but I am considering it in my next project. In "Club Tech iSeries Programming Tips Newsletter" edition march 17.and 24. it's described a way of "Using the Expat XML Parser from an RPG Program, Part 1 and 2." Go to "http://www.iSeriesNetwork.com", advanced search and enter keyword "Expat". B?rd Basma
    0 pointsBadges:
    report
  • FerencMantfeld
    AS400 has a JDBC driver to the data. This being the case, seemoredata (www.seemoredata.com ) can access it just like any regular database, and moreover, native queries are supported (no need to extract / ETL to a cube of any kind). Moreover, the data can be joined to other data that is on a different platform (Excel, CSV, Oracle, DB2, whatever) and then the consolidated result set can be output as XML, PDF, JDBC / CSV, flat file, Excel or whatever you prefer. You can also use XML as input if you desire to go the other way. full parameterization, etc. Regards: Ferenc
    0 pointsBadges:
    report
  • JPLamontre
    Here is a detailed sample, with only basic 400 tools : first, a sql sample (on sys files): SELECT SMTP.USERID sna_id,SMTP.ADDRESS sna_addres,SNA.WOS1USRP user_profile,trim(SMTP.SMTPUID) concat '@' concat SMTP.DOMROUTE mail frOM qaokp01a sna, qatmsmtpa smtp WHERE SNA.WOS1DDEN= SMTP.USERID and SNA.WOS1DDGN= SMTP.ADDRESS now, the magic step : convert the sql to xml syntax : SELECT '' ,'', SMTP.USERID ,'','', smtp.ADDRESS,'','',SNA.WOS1USRP,'' ,'', trim(SMTP.SMTPUID) concat '@' concat SMTP.DOMROUTE, '' ,'' FROM qaokp01a sna, qatmsmtpa smtp WHERE SNA.WOS1DDEN= SMTP.USERID and SNA.WOS1DDGN= SMTP.ADDRESS output it in a file (with strqmqry for example) Use the same method to insert the XML header : and the footer Copy the file to the IFS : CPYTOIMPF FROMFILE(.../...) TOSTMF('/.../test.xml') MBROPT(*REPLACE) STMFCODPAG(*PCASCII) RCDDLM(*CRLF) DTAFMT(*DLM) STRDLM(*NONE) FLDDLM(x'00') Open it directly with your internet browser. You have converted an SQL order into XML without any CL or RPG line. It will be powerfull if integrated in a cl or rpg ... If you have any headache to insert header and footer, uses "STRQMQRY outfile(aFile)" then uses "CPYTOIMPF MBROPT(*ADD)"
    0 pointsBadges:
    report
  • Martin40
    I was in the same situation as 'dburdette'. I simply wrote data directly to a stream file in the IFS utilising source downloaded from Scott Klement ( http://www.scottklement.com/httpapi/ ). I was able to provide the required data within a week of the request being made. Before that I'd never had any requirements regarding XML or the IFS.
    0 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following