The below job extracts records only if there is only one record for a key.
//************** TO ELIMINATE ALL DUPLICATES IN A FILE ************
//STEP010 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSPRINT DD DUMMY
//IN DD DSN=XXXXXXX.TSTS.INPUT,DISP=SHR
//OUT DD DSN=XXXXXXX.TSTS.INPUT1,DISP=OLD
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,10,CH) NODUPS
/*
The NODUPS option has to be used a little carefully, since it removes ALL the duplicate records, unlike the SUM FIELDS=NONE option in simple SORT, which retains ONE of the duplicate records.
eg) If the input is:
AAAAAAAAAA
BBBBBBBBBB
BBBBBBBBBB
BBBBBBBBBB
CCCCCCCCCC
CCCCCCCCCC
DDDDDDDDDD
The NODUPS option of ICETOOL returns:
AAAAAAAAAA
DDDDDDDDDD
whereas the SUM FIELDS=NONE option on simple SORT will return:
AAAAAAAAAA
BBBBBBBBBB
CCCCCCCCCC
DDDDDDDDDD
So, depending on your requirement, you may use either of them.
REF:
http://mainframe-tips-and-tricks.blogspot.com/2011/12/sort-to-eliminate-all-duplicates.html
阅读(1893) | 评论(0) | 转发(0) |