how we read xml file in cobol program

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

how we read xml file in cobol program

Postby vijay_singh7 » Sat Jul 09, 2011 3:43 pm

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
Posts: 2
Joined: Sun Jun 26, 2011 12:12 am
Has thanked: 0 time
Been thanked: 0 time

Re: how we read xml file in cobol program

Postby Robert Sample » Sat Jul 09, 2011 6:32 pm

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.
Robert Sample
Global moderator
Posts: 3716
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 278 times

Return to IBM Cobol


  • Related topics
    Last post