There could also be a "gotcha" that I forgot to mention. THe CPYTOIMPF command may put a end-of-file character at the end of the XML file (I'm not sure because I have not checked). An end-of-file character can be a problem for some applications. There might be a way to strip it out programmatically using QShell functions. Also, if you happen to use a third-party tool called Sequel, you can run the EXECUTE command that comes with the tool and output a structured DB2 file to an XML file. THanks, Kelly ________________________________ From: cobol400-l-bounces+kcookson=dotfoods.com@xxxxxxxxxxxx on behalf of Kelly Cookson Sent: Sun 7/31/2005 10:14 AM To: COBOL Programming on the iSeries/AS400 Subject: RE: [COBOL400-L] Converting AS/400 files to XML? The ILE COBOL route would be the best way to go if that's practical for you. Here's a less slick alternative. It's possible for a COBOL program to write out lines of XML to a flat DB2 database file, then use a CPYTOIMPF command to write the DB2 flat file to a stream file in the IFS. Each line of XML would be defined as a data structure in the working storage section. For example: 01 XML-AMOUNT-DUE-LINE 05 FILLER PIC X(11) VALUE "<AMOUNTDUE>". 05 XML-AMOUNT-DUE-VALUE PIC S9(11)V9(02). 05 FILLER PIC X(12) VALUE "</AMOUNTDUE>". Have the COBOL program fill in the amount due value, then write the XML-AMOUNT-DUE-LINE to the DB2 flat file. Do this same kind of thing for each line needed in the XML file. The DB2 flat file will contain the entire XML file, with each record in the DB2 file being one line in the XML file. The CPYTOIMPF command will transform the contents of the DB2 file into a regular XML file in the IFS. This is a bulky solution and does not let you take full advantage of iSeries XML solutions, but there it is. Good luck, Kelly > -----Original Message----- > From: cobol400-l-bounces@xxxxxxxxxxxx [SMTP:cobol400-l-bounces@xxxxxxxxxxxx] > On Behalf Of RogerBoyette@xxxxxx > Sent: Friday, July 29, 2005 7:48 PM > To: COBOL Programming on the iSeries/AS400 > Subject: RE: [COBOL400-L] Converting AS/400 files to XML? > > Geir, > You can find XML statements in the ILE COBOL manual for v5r3. You can get to > an online printable (or viewable) version at the online website for IBM > manuals > (http://publib.boulder.ibm.com/infocenter/iseries/v5r3/ic2924/index.htm. > I haven't had an opportunity to use this new feature but this is where I > would look first for COBOL. > I have downloaded some of the online printable manuals and stored them in > PDF format on my PC system for quick review. You might try downloading the > ILE COBOL Reference and Programming Guide manuals. > Hope this helps, > Roger > > > geir.kildal@xxxxxxxxxxxxxxx wrote: > > >Hello. > > > >I have been asked if I can deliver invoice-information on XML-format from > >an AS/400 COBOL-application. Does anyone of you know the best way of > >doing this? > > > >I'll make a flat file on the AS/400 containing the information needed, but > >how do I transform it into XML? > > > > > > > >Mvh. > > > >Geir Kildal > >TietoEnator AS > >Tlf . . : (+47) 611 73805 > >Mob. : (+47) 90 10 13 16 > >eMail: geir.kildal@xxxxxxxxxxxxxxx > >_______________________________________________ > >This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list > >To post a message email: COBOL400-L@xxxxxxxxxxxx > >To subscribe, unsubscribe, or change list options, > >visit: http://lists.midrange.com/mailman/listinfo/cobol400-l > >or email: COBOL400-L-request@xxxxxxxxxxxx > >Before posting, please take a moment to review the archives > >at http://archive.midrange.com/cobol400-l. > > > > > _______________________________________________ > This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list > To post a message email: COBOL400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/cobol400-l > or email: COBOL400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/cobol400-l. > -- This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/cobol400-l or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/cobol400-l.
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.