I have a input file with a mix of records which falls into 5 major groups based on a particular field. I need to sort each group seperately based on different keys. how can i do this?
SAMPLE INPUT
B Y 100
A H 150
D G 120
B K 50
C G 120
A H 125
D Y 175
A G 125
C K 145
C Y 175
OUTPUT REQ
C G 120
C K 145
C Y 175
B K 50
B Y 100
A G 125
A H 125
A H 150
D G 120
D Y 175
The output must be grouped based on some keys. in the example its the first field. there are 4 groups and i need in the order C,B,A,D. i am using dfsort
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Vinod,
Here's a DFSORT job that will do what you asked for:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
B Y 100
A H 150
D G 120
B K 50
C G 120
A H 125
D Y 175
A G 125
C K 145
C Y 175
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
* Switch A and C so order for sorting is C,B,A,D.
ALTSEQ CODE=(C3C1,C1C3)
* Specify AQ for first field so ALTSEQ table is used.
SORT FIELDS=(1,1,AQ,A,3,1,CH,A,5,3,ZD,A)
/*