Page 1 of 1

Break file into multiple with hdr/trl

PostPosted: Sat Oct 13, 2012 5:30 pm
by manojtyagi2012
Hi,

My requirement is to break a file into several files (total 10) based on the 2 byte code appearing at the end. Also Header and trailer needs to be written to each output file along with COUNT of records in each files excluding header/trailer record.There are 10 different codes which can appear A0, A1,A2... A9. at pos 79 , 80

Input file :
1. FB , LRECL=80. File appearing in sorted order of codes
2. Count appearing in header / trailer match and is equal to no of details records in input file.
2. format :
HEADER<<YYYYMMDD>><<FILENAME-10 bytes>><COUNT 8 bytes)
11111111111111111111111111111111111111111111111111111A0
11111111111111111111111111111111111111111111111111111A0
22222222222222222222222222222222222222222222222222222A1
22222222222222222222222222222222222222222222222222222A2
33333333333333333333333333333333333333333333333333333A3
TRAILER<<COUNT 8 bytes)

Output required.
1. 10 output files should be created containing records for each 2 byte code with header and trailer records
2. Header - First 24 bytes should be same as in Input file, but COUNT = no of record in the broken file excluding hdr/trl
3. Trailer - Same as in Input file, but COUNT = no of records in broken file (same as appearing in Header).


I am able to break the INPUT file into 10 files based on 2 byte code appearing at 79th pos, but don't know how to generate Header and trailer with the above requirement.

please help

Regards\
Manoj Tyagi

Re: Break file into multiple with hdr/trl

PostPosted: Mon Oct 15, 2012 3:24 am
by BillyBoyo
Have a look at this one from the "sibling" site:

http://ibmmainframes.com/about57659.html#288966