Page 1 of 1

counting duplicate records per control field

PostPosted: Wed Jul 21, 2010 8:02 am
by Sarah88
I'm trying to create a report by sorting a VB file and removing duplicates. However, the report should include the number of duplicates per control field. Can anyone advise? Is it possible to use SEQNUM to keep a counter per unique key?

i.e.
SORT FIELDS=(1,5,CH,A)
SUM FIELDS=NONE

Input Dataset
AAAAA
BBBBB
BBBBB
CCCCC
CCCCC
CCCCC
DDDDD
DDDDD
DDDDD
DDDDD
...

Output Dataset
AAAAA 001
BBBBB 002
CCCCC 003
DDDDD 04

Would the solution change if there were multiple fields in the SORT stmt?

Re: counting duplicate records per control field

PostPosted: Wed Jul 21, 2010 9:08 am
by dick scherrer
Hello and welcome to the forum,

Untested, but please try this:
//STEP0001 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
your data                                               
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  OUTFIL REMOVECC,NODETAIL,                                             
    SECTIONS=(1,5,                                                     
       TRAILER3=(1,5,COUNT=(M10,LENGTH=3)))         
/*