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
 

 

To Eliminates Duplicates and retain the first record

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

New User


Joined: 27 Feb 2006
Posts: 23
Location: delhi

PostPosted: Mon Mar 06, 2006 9:42 am    Post subject: To Eliminates Duplicates and retain the first record
Reply with quote

Hye.. please give me the the control card option to eliminates Duplicates and retain the first record.

To Eliminates Duplicates we have to do Sum=None
but to retain the first record what should i have to use . pls suggest..

To Eliminates Duplicates and retain the first record
Back to top
View user's profile Send private message

fixdoubts

New User


Joined: 21 Oct 2005
Posts: 54

PostPosted: Mon Mar 06, 2006 10:02 am    Post subject:
Reply with quote

Hi,

Try this out..
Code:
//STEP0100 EXEC PGM=SORT 
//SORTIN   DD *           
1111 AAAA 2222           
1111 AAAA 3333           
1111 AAAA 2222           
/*                       
//SORTOUT  DD SYSOUT=*   
//SYSIN DD *             
  SORT FIELDS=(1,14,CH,A)
  SUM FIELDS=NONE         
/*                       


The out put will be
Code:
1111 AAAA 2222
1111 AAAA 3333


Change the key as per your requirements

Regards,
Back to top
View user's profile Send private message
ramankapoor

New User


Joined: 27 Feb 2006
Posts: 23
Location: delhi

PostPosted: Mon Mar 06, 2006 10:08 am    Post subject: To Eliminates Duplicates and retain the first record
Reply with quote

But the solution u have given ,

in the output its showing two records while i like to retain just first record.
Back to top
View user's profile Send private message
fixdoubts

New User


Joined: 21 Oct 2005
Posts: 54

PostPosted: Mon Mar 06, 2006 10:26 am    Post subject:
Reply with quote

Hi,

There are only two distinct records

1111 AAAA 2222
1111 AAAA 3333

and the third record

1111 AAAA 2222

is a duplicate.

I think this is what u wanted. Keep only one record and eliminate dulicate
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 182
Location: hyderabad

PostPosted: Mon Mar 06, 2006 10:41 am    Post subject:
Reply with quote

Hi,
The other alternative solution is to use Select clause with first dup option.

SELECT FROM(INDD) TO(OUTDD) ON(P,M,F) FIRSTDUP

Thanks
Krishy
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: Mon Mar 06, 2006 9:26 pm    Post subject:
Reply with quote

Quote:
please give me the the control card option to eliminates Duplicates and retain the first record.


There are two ways to do this with DFSORT as shown below:

Method 1 - DFSORT/ICETOOL SELECT FIRST

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(p,m,f) FIRST


p,m,f is the starting position, length and format of the key. You can use multiple ON fields if you have multiple keys.

Method 2 - DFSORT SUM with EQUALS

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN DD *
  OPTION EQUALS
  SORT FIELDS=(p,m,f,A)
  SUM FIELDS=NONE
/*


EQUALS ensures that the first record of duplicates is kept (note that SELECT uses EQUALS automatically). p,m,f is the starting position, length and format of the key. You can use multiple keys if appropriate.

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
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 Record Not found in AlX but record re... mukun264 COBOL Programming 2 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am


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