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
 

 

How to get the records from a file which have dup values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
subhasis_50

Moderator


Joined: 09 Mar 2005
Posts: 363
Location: Earth

PostPosted: Mon May 16, 2005 2:27 pm    Post subject: How to get the records from a file which have dup values
Reply with quote

Hi,
I have a file. Which contains some records.
Lets consider 1,2,3,4,5 total five records are there.
From them 2 & 3 are same. How i can sort the file that only record comes in the output file which has duplicate value. Here the record 2 should come.
Thanks
Subhasis
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Mon May 16, 2005 3:05 pm    Post subject: Re: How to get the records from a file which have dup values
Reply with quote

Use "SUM FIELDS=NONE" to remove duplicate entries from the Input File.

Regards,

Priyesh.
Back to top
View user's profile Send private message
subhasis_50

Moderator


Joined: 09 Mar 2005
Posts: 363
Location: Earth

PostPosted: Mon May 16, 2005 3:11 pm    Post subject:
Reply with quote

Priyesh,
if i have used sum fields=none, then the output file will contains record 1,4,5 and 2. It will not only give the records which has duplicate. It will give other records also. My requirement is to get only those records which have duplicate values.
Thanks
Subhasis
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Mon May 16, 2005 3:22 pm    Post subject:
Reply with quote

Use ICETOOL as you can see below:
//TOOLIN DD *
SELECT FROM(INDD) TO(OUTDD) ON(1,22,CH) FIRST -
DISCARD(SAVEDD)

You will have in output only the first record and other in SAVEDD.
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Mon May 16, 2005 3:34 pm    Post subject:
Reply with quote

The best answer to your request is posted in this recent topic:
http://ibmmainframes.com/viewtopic.php?t=2582
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Mon May 16, 2005 3:58 pm    Post subject: Re: How to get the records from a file which have dup values
Reply with quote

Hi Subhasis,

Use this one...

Code:
//S1     EXEC PGM=ICETOOL                   
//TOOLMSG   DD SYSOUT=*                       
//DFSMSG    DD SYSOUT=*                       
//IN     DD DSN=INPUT,DISP=SHR
//OUT    DD DSN=OUT,         
//          DISP=(,CATLG,DELETE),             
//          RECFM=FB,LRECL=80,                 
//          SPACE=(80,(10,10),RLSE)           
//TOOLIN DD *                                 
  SELECT FROM(IN) TO(OUT) ON(1,5,CH) FIRSTDUP
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 May 16, 2005 8:53 pm    Post subject:
Reply with quote

Subhasis,

If your input looks something like this:

KEY1 R01
KEY2 R02
KEY2 R03
KEY3 R04
KEY4 R05

and you want your output to be:

KEY2 R02

then this DFSORT/ICETOOL job will do what you want:

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(1,5,CH) FIRSTDUP
/*


If you want your output file to look like this:

KEY2 R03

Use LASTDUP instead of FIRSTDUP in the SELECT operator.

For complete details on all of the things you can do with the SELECT operator of DFSORT's ICETOOL, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/6.11?DT=20050222160456

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, 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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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