Hi,
It's a long time I have written anything using the DFSORT and I am a little rusty.
My requirement is to get all the first occurences of duplicate records plus the single records.
In addition to this, I have to modify a flag for the duplicate records.
Input File:
Output File:
This is what i have written:
And then I merge SORTOUT1 and DISCARD1 file.
This is working right now, but I just wanted to know if this ccan be done any simpler.
It's a long time I have written anything using the DFSORT and I am a little rusty.
My requirement is to get all the first occurences of duplicate records plus the single records.
In addition to this, I have to modify a flag for the duplicate records.
Input File:
Code:
Key Flag Balance Extra fields
10001703 010100104 XXXXXXXXXXXX
10001745 010100104 XXXXXXXXXXXX
10002694 010100104 XXXXXXXXXXXX
11614135 069999999 XXXXXXXXXXXX
11614135 050000000 XXXXXXXXXXXX
12299954 070000000 XXXXXXXXXXXX
12299954 090000000 XXXXXXXXXXXX
Output File:
Code:
Key Flag Balance Extra fields
10001703 010100104 XXXXXXXXXXXX
10001745 010100104 XXXXXXXXXXXX
10002694 010100104 XXXXXXXXXXXX
11614135 1 069999999 XXXXXXXXXXXX
12299954 1 090000000 XXXXXXXXXXXX
This is what i have written:
Code:
SELECT FROM(SORTINP1) TO(SORTEMP1) ON(001,008,CH) -
ALLDUPS -
DISCARD(DISCARD1) -
USING(CTL1)
SELECT FROM(SORTEMP1) TO(SORTOUT1) ON(001,008,CH) -
FIRST
//CTL1CNTL DD *
SORT FIELDS=(001,008,CH,A, -
020,009,PD,A)
INREC OVERLAY=(010:C'1')
And then I merge SORTOUT1 and DISCARD1 file.
This is working right now, but I just wanted to know if this ccan be done any simpler.