Page 1 of 1

convert xml to flat file

PostPosted: Thu Jan 15, 2015 3:04 am
by k singh
hi
I need some help. through xmlgen I have created a xml file which looks like this
<?xml version="1.0"?>
<FILE DSN="XXXXXXXXX">
<ksingh RECORD="00001">
<AA>2008</AA>
<BB>LL</BB>
<CC>002</CC>
<DD>03</DD>
<ksingh>
<ksingh RECORD="00001">
<AA>2009</AA>
<BB>EL</BB>
<CC>001</CC>
<DD>04</DD>
<ksingh>

I want to convert it to something like this
2008,LL,002,03
2009,EL,001,04

please help me on this one. thanks a lot

Re: convert xml to flat file

PostPosted: Thu Jan 15, 2015 3:41 am
by NicC
You cannot do this using JCL - although you may need JCL to execute the program that will do this. So - are you wanting to write a program (which language) or see if there is a utility program that can be utilised to do this for you?

Re: convert xml to flat file

PostPosted: Thu Jan 15, 2015 3:52 am
by k singh
I can write a program in java or perl to do so
I was just curious if there is some jcl or utility program to do it.
this xml was created from flat file using xmlgen so I thought may be there is some way to reverse it

Re: convert xml to flat file

PostPosted: Thu Jan 15, 2015 5:13 pm
by NicC
The PL/1 and COBOL languages both ahve XML facilities. IT is possible that the sort utilities could extract the data you want. I will move to DFSort and maybe someone there will be able to give you clues as to how to go about it.