Howard Brazee wrote on 10/18/2006 11:51:17 AM: > Is there a way to use the sort utility (or another tool) to come up with > the key with the most duplicates only? > > I want to search a file to find out which person has the most detail > records, and how many detail records that person has.
Howard, Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your name field was in positions 1-20, but you can change the job appropriately for other positions. //S1 EXEC PGM=ICETOOL //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //IN DD DSN=... input file //T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS) //OUT DD DSN=... output file //TOOLIN DD * SORT FROM(IN) USING(CTL1) SORT FROM(T1) TO(OUT) USING(CTL2) /* //CTL1CNTL DD * SORT FIELDS=(1,20,CH,A) OUTFIL FNAMES=T1,REMOVECC,NODETAIL, SECTIONS=(1,20, TRAILER3=(1,20,X,COUNT=(M11,LENGTH=8))) /* //CTL2CNTL DD * SORT FIELDS=(22,8,ZD,D) OUTFIL FNAMES=OUT,ENDREC=1 /* Frank Yaeger - DFSORT Team (IBM) Specialties: PARSE, JFY, SQZ, ICETOOL, IFTHEN, OVERLAY, Symbols, Migration => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/ ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html