Page 1 of 1

how we read xml file in cobol program

PostPosted: Sat Jul 09, 2011 3:43 pm
by vijay_singh7
i have xml file that i want to read in cobol program and do some manipulation and then save into db2 database i don't know how to read xml file so please provide me help regarding this

Re: how we read xml file in cobol program

PostPosted: Sat Jul 09, 2011 6:32 pm
by Robert Sample
Find the COBOL Language Reference manual on the IBM web site and read about the XML PARSE statement, available in Enterprise COBOL for quite some time.

And be aware that handling XML can be challenging since XML is treated as one long string of data and file reads on the mainframe are limited as to how long the record length can be. Usually you wind up creating a very large variable (the last time I did anything with XML, the variable was defined as PIC X(10000000) in the code), reading the file and storing each record in the very large variable, then using XML PARSE on the very large variable. Then you have to be prepared to handle the various tags returned by the parser.