Page 1 of 1

Syncsort equivalent to copy first dup rec

PostPosted: Mon Jan 12, 2009 6:17 pm
by ranga_subham
Hi,

I have below job that copies every first duplicate record to o/p file.

//SORT0001 EXEC PGM=SYNCTOOL                     
//TOOLMSG  DD SYSOUT=*                           
//SSMSG    DD SYSOUT=*                           
//SORTI    DD *                                 
ABCD1                                           
ABCD2                                           
BCDE1                                           
BCDE2                                           
CDEF1                                           
CDEF2                                           
//SORTO    DD SYSOUT=*                           
//TOOLIN   DD *                                 
 SELECT FROM(SORTI) TO(SORTO) ON(1,4,CH) FIRSTDUP
/*                                               


What is the equivalent job for the above without using SYNCTOOL / ICETOOL utility?

Thanks.

Re: Syncsort equivalent to copy first dup rec

PostPosted: Mon Jan 12, 2009 6:27 pm
by ranga_subham
Ok folks !

I have achieved it this way...... :idea:

//SORT0002 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD *                             
ABCD1                                       
ABCD2                                       
BCDE1                                       
BCDE2                                       
CDEF1                                       
CDEF2                                       
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                             
 OPTION COPY                                 
 INREC OVERLAY(10:SEQNUM,3,ZD,RESTART=(1,4))
 OUTFIL INCLUDE=(10,3,ZD,EQ,001),OUTREC=(1,5)
/*                                           


Please let me know if there are any other ways possible to achieve it. :)

Thanks.

Re: Syncsort equivalent to copy first dup rec

PostPosted: Tue Jan 13, 2009 3:20 am
by Alissa Margulies
Will every record have a duplicate?
If there is a unique record, do you want that included in the output as well? If so, you can code the following:
//SYSIN DD *
  SORT FIELDS=(1,5,CH,A),EQUALS
  SUM FIELDS=NONE

Re: Syncsort equivalent to copy first dup rec

PostPosted: Tue Jan 13, 2009 6:42 pm
by ranga_subham
You are right Alissa. Not every record will have duplicate.

Thank you.

Re: Syncsort equivalent to copy first dup rec

PostPosted: Tue Jan 13, 2009 6:46 pm
by ranga_subham
Alissa, I have corrected the code as below to work it as expected !

//SYSIN DD *
  SORT FIELDS=(1,4,CH,A),EQUALS
  SUM FIELDS=NONE


Thanks.