Posted: Wed Jan 05, 2011 11:07 am Post subject: Extracting multiple detailed records
My input file is having multiple country reports with multiple Header, multiple Detailed and multiple Trailer records for each country.
Record lenght is of 80 bytes fixed.
I need to split detailed records for each particular country into seperate output files.
There are different Headers record formats and different trailer record formats.
We can identify that a particular country by one of Header record is having Country Code at 10th position with 3 bytes length.
Then after few more Header records, Detailed records will start, which we can identify as for detailed records the first 5 bytes is numeric.
we need to extract all this numeric records into output file untill the first 5 bytes are spaces or equal to "Total"
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Jan 05, 2011 11:26 am Post subject:
psmadhusudhan,
Do you always have 2 groups or do you have variable number of output files? How do you handle variable groups? Are you going to predefine max output files ? _________________ Kolusu
www.linkedin.com/in/kolusu
I have 3 groups in input file so I shall have 3 output files also.
Each seperate country detailed records should go to one seperate file.
And each country will repeat only once in the input file.
Max output files are three in this scenario as input countries as three. _________________ Thanks
Madhu Sudhan
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Jan 05, 2011 7:50 pm Post subject:
Assuming a 'Total' record is present after each group (regardless of whether or not a space record is present), you can use a DFSORT job like the following to do what you asked for:
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Sorry I have some corrections in my input file structure
1. My input file is variable file with RECL 133
2. I might have more than 3 country groups in input file, where as I need to extract country codes of 11,22,33 onlyt to rspective output files.
3. There might space record in between last numeric record and record with "Total" _________________ Thanks
Madhu Sudhan
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum