MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Eliminate Duplicates using JCL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
ST
Beginner


Joined: 04 Jan 2003
Posts: 24
Topics: 12

PostPosted: Mon Jan 06, 2003 8:17 pm    Post subject: Eliminate Duplicates using JCL Reply with quote

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
View user's profile Send private message
Venkata Ramana Reddy
Beginner


Joined: 02 Dec 2002
Posts: 70
Topics: 19
Location: California

PostPosted: Mon Jan 06, 2003 8:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jan 07, 2003 12:01 pm    Post subject: Reply with quote

ST,

The SORT job shown by Venkata will give you unique records and one record from each set of duplicates. If you add:

Code:

  OPTION EQUALS


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
View user's profile Send private message Send e-mail Visit poster's website
ST
Beginner


Joined: 04 Jan 2003
Posts: 24
Topics: 12

PostPosted: Tue Jan 07, 2003 7:57 pm    Post subject: Reply with quote

Frank,

Thank you..

ST
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group