View previous topic :: View next topic
|
Author |
Message |
Aneesh
New User
Joined: 30 Sep 2006 Posts: 60
|
|
|
|
Hi,
I have a file with length 80 and format FB - with a counter of 3 bytes in positions 1-3, followed by a space, followed by a identifier string of 2 byte character data.
Input file
001 AA
002 AA
003 AA
001 BB
009 BB
005 CC
007 CC
I need to create an output file such that the identifier string gets written as a header record for the group of records. So, the output will be:
AA
001
002
003
BB
001
009
CC
005
007
Can thiis be done using sort?
Thanks,
Aneesh. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Below step will give required output...
Code: |
//STEP10 EXEC PGM=SORT
//SORTIN DD *
001 AA
002 AA
003 AA
001 BB
009 BB
005 CC
007 CC
/*
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(5,2,CH,A)
OUTFIL REMOVECC,SECTIONS=(5,2,HEADER3=(5,2,80:X)),BUILD=(1,3,80:X)
/*
|
Output,
Code: |
AA
001
002
003
BB
001
009
CC
005
007 |
|
|
Back to top |
|
|
Aneesh
New User
Joined: 30 Sep 2006 Posts: 60
|
|
|
|
Thanks a lot |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Aneesh wrote: |
Thanks a lot |
Cheers... |
|
Back to top |
|
|
|