MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

To identify duplicate records in a file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
kanitha-mvs
Beginner


Joined: 17 May 2006
Posts: 26
Topics: 17

PostPosted: Thu Jun 04, 2009 7:47 am    Post subject: To identify duplicate records in a file Reply with quote

Hi,

I have a file of 80 LRECL.
IN1 - key field 1 to 15
Now i want to know the duplicate records in key field 1 to 15.
Using "Sort with SUM FIELDS=NONE", am able to remove the duplicates. But i need to track those duplicate entries in a separate file.
Could this be done by using easytrieve or any other utility?

EG:
If IN1 contains the following records,
aaaaa
aaaaa
bbbbb
ccccc
ccccc
the output file should have
aaaaa
ccccc

Thanks,
kanitha-mvs.
Back to top
View user's profile Send private message
callanand
Beginner


Joined: 12 Jun 2007
Posts: 23
Topics: 2

PostPosted: Thu Jun 04, 2009 8:46 am    Post subject: Reply with quote

kanitha-mvs,

You can use the below JCL to get the desired result. However there are many examples of dealing with duplicates in this forum.

Code:
//STEP01   EXEC PGM=ICETOOL
//TOOLMSG  DD  SYSOUT=*
//DFSMSG   DD  SYSOUT=*
//INPUT1   DD  DSN=your input file,DISP=SHR
//OUTPUT1  DD  DSN=all duplicates will come here,DISP=SHR
//DISCARD1 DD  DSN=all non duplicates will comes here,DISP=SHR
//TOOLIN   DD *
 SELECT FROM(INPUT1) TO(OUTPUT1) DISCARD(DISCARD1) ON(1,15,ZD) ALLDUPS
/*

If you want to have only one occurance of duplicates in above OUTPUT1 then have a sum fiels=none in the next step
Back to top
View user's profile Send private message
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Thu Jun 04, 2009 9:54 am    Post subject: Reply with quote

kanitha-mvs,

Using SyncSort for z/OS, records removed by SUM processing can be written to a separate data set defined by the SORTXSUM DD statement as follows:
Code:
//STEP1  EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=input.records
//SORTOUT  DD DSN=summed.records
//SORTXSUM DD DSN=duplicate.records
//SYSIN    DD *
   SORT FIELDS=(1,15,CH,A)
   SUM FIELDS=NONE,XSUM
/*

_________________
Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
priyaranjan.mishra
Beginner


Joined: 21 Jan 2008
Posts: 17
Topics: 9

PostPosted: Thu Nov 19, 2009 7:53 am    Post subject: Reply with quote

Another simple solution is as follows:
Code:

//S1    EXEC  PGM=ICETOOL                     
//TOOLMSG DD SYSOUT=*                         
//DFSMSG  DD SYSOUT=*                         
//IN DD *                                     
aaaaa                                         
aaaaa                                         
bbbbb                                         
ccccc                                         
ccccc                                         
/*                                           
//OUT DD SYSOUT=*                             
//TOOLIN DD *                                 
  SELECT FROM(IN) TO(OUT) ON(1,15,CH) FIRSTDUP
/*
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Thu Nov 19, 2009 3:38 pm    Post subject: Reply with quote

Did you test this?

Did it create the required output?
_________________
All the best,

di
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group