puneetvirmani143
New User
Joined: 24 Jul 2007 Posts: 55 Location: noida
|
|
|
|
Hi,
My requirement is to Split 1 file into 2 files based on Code appearing at last 2 bytes. either A1 or A2. Input file has Header and trailer also.
COUNT of Detail records is appearing in Header and Trailer and is equal.
Below is the Input file
Code: |
HEADER20120202FILENAME00000005
1111111111111111111111111111111111111A1
2222222222222222222222222222222222222A1
3333333333333333333333333333333333333A1
4444444444444444444444444444444444444A2
5555555555555555555555555555555555555A2
TRAILER00000005 |
Here '00000005' appearing in header ad Trailer is the COUNT of detail records.
OutPut Expected
FILE 1
Code: |
HEADER20120202FILENAME00000003
1111111111111111111111111111111111111A1
2222222222222222222222222222222222222A1
3333333333333333333333333333333333333A1
TRAILER00000003
|
FILE2
Code: |
HEADER20120202FILENAME00000002
4444444444444444444444444444444444444A2
5555555555555555555555555555555555555A2
TRAILER00000002 |
I am able to create 2 output file based on Code appearing at 79th and 80th pos (2 char) and write TRAILER as well.
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=OUT1,
INCLUDE=(1,6,CH,EQ,C'HEADER',OR,79,2,CH,EQ,C'A1'),
TRAILER1=('TRAILER',COUNT-1=(M11,LENGTH=8)),REMOVECC
OUTFIL FNAMES=OUT2,
INCLUDE=(1,6,CH,EQ,C'HEADER',OR,79,2,CH,EQ,C'A2'),
TRAILER1=('TRAILER',COUNT-1=(M11,LENGTH=8)),REMOVECC
|
But unable to Update the COUNT in Header. Information appearing in Header should be same in both Output files, except the COUNT will be updated to indicate no. of records written in each Output File.
Can anyone please help ? |
|