Monday, September 26, 2011

SORT - Extract only duplicate records



The below job extracts only the duplicate records from the input 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) ALLDUPS  
/*


This is very useful when you want only the duplicates, and you need ALL the duplicate records.

eg) If the input is:

AAAAAAAAAA
BBBBBBBBBB
BBBBBBBBBB
BBBBBBBBBB
CCCCCCCCCC
CCCCCCCCCC
DDDDDDDDDD


The ALLDUPS option of ICETOOL returns:

BBBBBBBBBB
BBBBBBBBBB
BBBBBBBBBB
CCCCCCCCCC
CCCCCCCCCC

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.