Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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
Author Message
subhasis_50

Moderator


Joined: 09 Mar 2005
Posts: 367
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
References
priyesh.agrawal

Global Moderator


Joined: 28 Mar 2005
Posts: 1509
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: 367
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

Moderator


Joined: 10 Mar 2005
Posts: 478
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

Moderator


Joined: 10 Mar 2005
Posts: 478
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

Global Moderator


Joined: 28 Mar 2005
Posts: 1509
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: 4579
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL All times are GMT + 6 Hours
Page 1 of 1