Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort input and keep only 1st occurrence of the duplicate rec

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Smita Sebastian

New User


Joined: 30 May 2007
Posts: 7
Location: India

PostPosted: Wed Sep 19, 2007 5:22 pm    Post subject: Sort input and keep only 1st occurrence of the duplicate rec
Reply with quote

Hi,
I have a requirement where the input file may have duplicate records. The file should be sorted such that if duplicates are present, then only the first occurrence/record is written to the output. For records with no duplicates, they also should be written to the same output.

Input -
AAAAA
BBBBB
CCCCC
AAAAA
CCCCC
DDDDD

OUTPUT expected-
AAAAA
BBBBB
CCCCC
DDDDD

I searched a sloution for this in the previous posts, but did not find one. Please help..

Thanks!
Back to top
View user's profile Send private message

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Sep 19, 2007 5:35 pm    Post subject: Reply to: Sort input and keep only 1st occurrence of the dup
Reply with quote

You can use ICETOOL SELECT operator

Code:

//DOIT    EXEC PGM=ICETOOL                                   
//TOOLMSG   DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//INP     DD DSN=...  input file                     
//OUT  DD DSN=...   output file
//TOOLIN      DD *                                           
SELECT  FROM(INP) TO(OUT) ON(1,5,CH) FIRST               
/*                                                           


Input:

Code:

AAAAA
BBBBB
CCCCC
AAAAA
CCCCC
DDDDD


Output:

Code:

AAAAA 
BBBBB 
CCCCC 
DDDDD 
Back to top
View user's profile Send private message
Raphael Bacay

New User


Joined: 04 May 2007
Posts: 58
Location: Manila, Philippines

PostPosted: Wed Sep 19, 2007 8:00 pm    Post subject:
Reply with quote

Code:

//STEP10  EXEC PGM=SORT
//SYSOUT    DD SYSOUT=*               
//SORTIN    DD DSN=...,DISP=SHR
//SORTOUT   DD DSN=...                 
//SYSIN     DD *
  SORT FIELDS=(1,5,CH,A)
  SUM FIELDS=NONE                                       
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Sep 19, 2007 8:34 pm    Post subject:
Reply with quote

Smita,

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/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
Smita Sebastian

New User


Joined: 30 May 2007
Posts: 7
Location: India

PostPosted: Thu Sep 20, 2007 11:24 am    Post subject: Reply to: Sort input and keep only 1st occurrence of the dup
Reply with quote

Hi.

Thanks Aaru. That worked!

Frank, the IBM link that you send is very useful. Thankyou.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us