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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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