View previous topic :: View next topic
|
Author |
Message |
subhasis_50
Moderator
Joined: 09 Mar 2005 Posts: 363 Location: Earth
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Use "SUM FIELDS=NONE" to remove duplicate entries from the Input File.
Regards,
Priyesh. |
|
Back to top |
|
|
subhasis_50
Moderator
Joined: 09 Mar 2005 Posts: 363 Location: Earth
|
|
|
|
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 |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
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 |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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:
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:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
|