IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Delete duplicate records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rswathi_1208

New User


Joined: 14 May 2010
Posts: 11
Location: chennai

PostPosted: Sat May 15, 2010 12:56 pm
Reply with quote

Hi,

Is there a way to delete duplicate records?

Following is my Sort input..

//SORTIN1 DD *
1234566789
1234384848
2632366334
2834748758
//SORTIN2 DD *
1234566789
2834748758
2948343834


I need my Sort out as

1234384848
2632366334
2834748758

Pls suggest
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sat May 15, 2010 3:21 pm
Reply with quote

Hi,

isn't 2834748758 also a duplicate record ?

Gerry
Back to top
View user's profile Send private message
santoshkumarmanilakkoju

New User


Joined: 24 Nov 2009
Posts: 37
Location: Don't know

PostPosted: Sat May 15, 2010 4:16 pm
Reply with quote

Can you be a little clear with your requirement:

As I understand you have two files and you want all the unmatched records to write into a third file.
Back to top
View user's profile Send private message
r arunmoezhi

New User


Joined: 26 Jun 2009
Posts: 32
Location: Chennai

PostPosted: Sat May 15, 2010 4:20 pm
Reply with quote

Can you be more specific.
Will SORTIN1 file contain duplicates?
Will SORTIN2 file contain duplicates?
After merging both the files and if a duplicate is found, do you want to delete all the instances of the duplicate records or do you want to keep the first duplicate.
Please find below a generic version of sort.


Code:

//S1       EXEC  PGM=ICETOOL                 
//TOOLMSG  DD SYSOUT=*                       
//DFSMSG   DD SYSOUT=*                       
//SORTIN1  DD *                             
1234566789                                   
1234384848                                   
2632366334                                   
2834748758                                   
/*                                           
//SORTIN2  DD *                             
1234566789                                   
2834748758                                   
2948343834                                   
/*                                           
//TEMP     DD DSN=&TEMP,DISP=(MOD,PASS)     
//OUT      DD SYSOUT=*                       
//TOOLIN   DD *                             
COPY FROM(SORTIN1) TO(TEMP)                 
COPY FROM(SORTIN2) TO(TEMP)                 
SELECT FROM(TEMP) TO(OUT) ON(1,10,CH) NODUPS
/*                                           

The keyword 'NODUPS' can be replaced with any of the following:
FIRST
FIRSTDUP

Check if any of the keywords suits your requirement. Or else post a detailed requirement.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sat May 15, 2010 4:42 pm
Reply with quote

Hi,

no need to copy the files to TEMP

this will give you the same result

Code:
//S1       EXEC  PGM=ICETOOL                     
//TOOLMSG  DD SYSOUT=*                           
//DFSMSG   DD SYSOUT=*                           
//IN       DD *                                   
1234566789                                       
1234384848                                       
2632366334                                       
2834748758                                       
/*                                               
//         DD *                                   
1234566789                                       
2834748758                                       
2948343834                                       
/*                                               
//OUT      DD SYSOUT=*                           
//TOOLIN   DD *                                   
SELECT FROM(IN) TO(OUT) ON(1,10,CH) NODUPS       


Gerry
Back to top
View user's profile Send private message
r arunmoezhi

New User


Joined: 26 Jun 2009
Posts: 32
Location: Chennai

PostPosted: Sat May 15, 2010 5:00 pm
Reply with quote

ya you are right gcicchet. We can concatenate the input files in the JCL itself.
But i deliberately kept them as two seperate DD statements since the requestor did not post a clear requirement.
What if he/she wants to handle duplicates in the two files differentely
Back to top
View user's profile Send private message
rswathi_1208

New User


Joined: 14 May 2010
Posts: 11
Location: chennai

PostPosted: Sat May 15, 2010 10:57 pm
Reply with quote

Thank You all..I used 'SELECT FROM(IN) TO(OUT) ON(1,10,CH) NODUPS' and it worked out for me...
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat May 15, 2010 11:09 pm
Reply with quote

Good to hear it is working - thank you for posting your solution icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 4
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts DELETE SPUFI DB2 1
Search our Forums:

Back to Top