MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
ST Beginner Joined: 04 Jan 2003 Posts: 24 Topics: 12
Posted: Mon Jan 06, 2003 8:17 pm Post subject: Eliminate Duplicates using JCL
Hi,
Can anyone tell me how we can eliminate Duplicate records of a file thru JCL? thru SORT?
pls let me know..
Thanks,
ST
Back to top
Venkata Ramana Reddy Beginner Joined: 02 Dec 2002 Posts: 70 Topics: 19 Location: California
Posted: Mon Jan 06, 2003 8:48 pm Post subject:
ST,
If you have key field of length 9 bytes on which you want to eliminate duplicates then the following JCL will give you the results.
Code:
//STEP001 EXEC PGM=SORT
//*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR.INPUT.FILE,
// DISP=SHR
//SORTOUT DD DSN=YOUR.OUTPUT.FILE,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
SORT FIELDS=(1,9,CH,A)
SUM FIELDS=NONE
/*
_________________ Venkataramana
-- Good judgement comes from experience, and often experience comes from bad judgement.
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Jan 07, 2003 12:01 pm Post subject:
ST,
The SORT job shown by Venkata will give you unique records and one record from each set of duplicates. If you add:
then you'll be sure to get the first record of each set of duplicates.
Another way to do this is to use a DFSORT ICETOOL job as follows
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,9,CH) FIRST
/*
SUM FIELDS=NONE and FIRST do the same thing. But DFSORT's ICETOOL lets you manipulate duplicate records in other ways as well. Besides FIRST, you can specify LAST, FIRSTDUP, LASTDUP, NODUPS, ALLDUPS, EQUAL(n), LOWER(n) and HIGHER(n).
For more information on DFSORT's ICETOOL, see Chapter 6 of "DFSORT Application Programming Guide" at:
http://publibz.boulder.ibm.com:80/cgi-bin/bookmgr_OS390/BOOKS/ICECA109/6.0?DT=20020722140254 _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
ST Beginner Joined: 04 Jan 2003 Posts: 24 Topics: 12
Posted: Tue Jan 07, 2003 7:57 pm Post subject:
Frank,
Thank you..
ST
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum