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!
Software/Hardware used:
ASKED:
April 5, 2005 5:57 PM
UPDATED:
April 8, 2005 3:47 AM
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.
Check out this link
http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,295199,sid63_gci1053229,00.html
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
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
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)”
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.