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 

sort stmt to avoid duplicates

 
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
arv
Beginner


Joined: 30 Mar 2003
Posts: 13
Topics: 11

PostPosted: Wed Apr 30, 2003 9:52 am    Post subject: sort stmt to avoid duplicates Reply with quote

Hi all,

What is the command used to avoid duplicates while writing to out dataset while using jcl sort.Kindly explain in detail.


with regards,

arv.
Back to top
View user's profile Send private message
Tophe
Beginner


Joined: 02 Dec 2002
Posts: 8
Topics: 0
Location: Tours, France

PostPosted: Wed Apr 30, 2003 10:12 am    Post subject: Reply with quote

Arv,

Do you try this LINK ?

Wink

Regards

Tophe
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: Wed Apr 30, 2003 10:31 am    Post subject: Reply with quote

You can use this DFSORT/ICETOOL job to eliminate duplicates - for each ON field (key), you'll get all non-duplicates and the first record of each set of duplicates:

Code:

//S1 EXEC PGM=ICEMAN
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...   input file
//OUT DD DSN=...  output file
//TOOLIN DD *
  SELECT FROM(IN) TO(OUT) ON(p,m,f) FIRST
/*


p,m,f is the starting position, length and format of the key field.

SELECT also allows you to handle duplicates in other ways using the operands LAST, FIRSTDUP, LASTDUP, ALLDUPS, NODUPS, HIGHER(n), LOWER(n), EQUAL(n) and DISCARD(savedd).

For complete information on DFSORT's ICETOOL, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICECA109/6.0?DT=20020722140254

and:

http://www.storage.ibm.com/software/sort/mvs/uq90053/online/srtmutol.html

The equivalent of SELECTwith FIRST can also be done with this DFSORT job:

Code:

//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN DD *
  SORT FIELDS=(p,m,f,A)
  OPTION EQUALS
  SUM FIELDS=NONE
/*


But note that SUM FIELDS=NONE only does the equivalent of SELECT with FIRST - it cannot do the equivalent of the other SELECT parameters listed above (LAST, FIRSTDUP, etc).
_________________
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
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Fri Nov 28, 2003 2:56 am    Post subject: Reply with quote

Tophe,
Quote:

Do you try this LINK ?


I DID ... Embarassed Crying or Very sad Evil or Very Mad Twisted Evil Rolling Eyes Wink
Back to top
View user's profile Send private message Send e-mail
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