| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| kanitha-mvs Beginner
 
 
 Joined: 17 May 2006
 Posts: 26
 Topics: 17
 
 
 | 
			
				|  Posted: Thu Jun 04, 2009 7:47 am    Post subject: To identify duplicate records in a file |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| callanand Beginner
 
  
 Joined: 12 Jun 2007
 Posts: 23
 Topics: 2
 
 
 | 
			
				|  Posted: Thu Jun 04, 2009 8:46 am    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| amargulies Beginner
 
 
 Joined: 10 Jan 2007
 Posts: 123
 Topics: 0
 
 
 | 
			
				|  Posted: Thu Jun 04, 2009 9:54 am    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| priyaranjan.mishra Beginner
 
 
 Joined: 21 Jan 2008
 Posts: 17
 Topics: 9
 
 
 | 
			
				|  Posted: Thu Nov 19, 2009 7:53 am    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| papadi Supermod
 
 
 Joined: 20 Oct 2009
 Posts: 594
 Topics: 1
 
 
 | 
			
				|  Posted: Thu Nov 19, 2009 3:38 pm    Post subject: |   |  
				| 
 |  
				| Did you test this? 
 Did it create the required output?
 _________________
 All the best,
 
 di
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |