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

Need to remove duplicates


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

New User


Joined: 08 Feb 2008
Posts: 23
Location: Hyderabad

PostPosted: Fri Apr 06, 2012 3:14 am
Reply with quote

my data is like this:

604398392 - 1 - 1
604398392 - 1 - 1
604398392 - 1 - 2
604398392 - 1 - 2
604398392 - 1 - 2
604398392 - 1 - 3
604398392 - 1 - 3
604398392 - 1 - 3
604398392 - 1 - 3
604398392 - 1 - 3
604398392 - 1 - 3

and my requirement is that the records should appear in this form:

604398392 - 1 - 1
604398392 - 1 - 2
604398392 - 1 - 3

Please advise what would be the syntax to achieve this thru IBM SORT utility
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Apr 06, 2012 3:50 am
Reply with quote

If your records are already in sorted order (as shown in your example), you can use a DFSORT MERGE job like the following:

Code:

//S1 EXEC PGM=SORT                 
//SYSOUT DD SYSOUT=*               
//SORTIN01 DD *                   
604398392 - 1 - 1                 
604398392 - 1 - 1                 
604398392 - 1 - 2                 
604398392 - 1 - 2                 
604398392 - 1 - 2                 
604398392 - 1 - 3                 
604398392 - 1 - 3                 
604398392 - 1 - 3                 
604398392 - 1 - 3                 
604398392 - 1 - 3                 
604398392 - 1 - 3                 
//SORTOUT DD SYSOUT=*             
//SYSIN DD *                       
  MERGE FIELDS=(1,17,CH,A)         
  SUM FIELDS=NONE                 


or a DFSORT/ICETOOL SELECT job like the following:

Code:

//S2    EXEC  PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG  DD SYSOUT=*                                     
//IN DD *                                                 
604398392 - 1 - 1                                         
604398392 - 1 - 1                                         
604398392 - 1 - 2                                         
604398392 - 1 - 2                                         
604398392 - 1 - 2                                         
604398392 - 1 - 3                                         
604398392 - 1 - 3                                         
604398392 - 1 - 3                                         
604398392 - 1 - 3                                         
604398392 - 1 - 3                                         
604398392 - 1 - 3                                         
//OUT DD SYSOUT=*                                         
//TOOLIN DD *                                             
SELECT FROM(IN) TO(OUT) ON(1,17,CH) FIRST USING(CTL1)     
//CTL1CNTL DD *                                           
  OPTION COPY                                             


If your records are NOT already in sorted order, you can use a DFSORT SORT job like the following:

Code:

//S3 EXEC PGM=SORT                 
//SYSOUT DD SYSOUT=*               
//SORTIN DD *                   
604398392 - 1 - 1                 
604398392 - 1 - 1                 
604398392 - 1 - 2                 
604398392 - 1 - 2                 
604398392 - 1 - 2                 
604398392 - 1 - 3                 
604398392 - 1 - 3                 
604398392 - 1 - 3                 
604398392 - 1 - 3                 
604398392 - 1 - 3                 
604398392 - 1 - 3                 
//SORTOUT DD SYSOUT=*             
//SYSIN DD *                       
  SORT FIELDS=(1,17,CH,A)         
  SUM FIELDS=NONE                 


or a DFSORT/ICETOOL SELECT job like the following:

Code:

//S2    EXEC  PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG  DD SYSOUT=*                                     
//IN DD *                                                 
604398392 - 1 - 1                                         
604398392 - 1 - 1                                         
604398392 - 1 - 2                                         
604398392 - 1 - 2                                         
604398392 - 1 - 2                                         
604398392 - 1 - 3                                         
604398392 - 1 - 3                                         
604398392 - 1 - 3                                         
604398392 - 1 - 3                                         
604398392 - 1 - 3                                         
604398392 - 1 - 3                                         
//OUT DD SYSOUT=*                                         
//TOOLIN DD *                                             
SELECT FROM(IN) TO(OUT) ON(1,17,CH) FIRST


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
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 Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Remove leading zeroes SYNCSORT 4
No new posts How to remove block of duplicates DFSORT/ICETOOL 8
This topic is locked: you cannot edit posts or make replies. Compare files with duplicates in one ... DFSORT/ICETOOL 11
No new posts To Remove spaces (which is in hex for... JCL & VSAM 10
Search our Forums:

Back to Top