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 on 2 fields but remove duplicate on one field.

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


Joined: 12 Feb 2008
Posts: 142
Topics: 67

PostPosted: Thu Apr 09, 2009 3:58 pm    Post subject: Sort on 2 fields but remove duplicate on one field. Reply with quote

Hi,

I sort my data on 2 fields

SORT FIELDS=(41,09,CH,A,01,04,CH,A)

but need to remove duplicates on one field, (41,09,CH,A), can I do that in Single SORT?

Thanks
_________________
Arvind
"You can make a difference with your smile. Have that with you always"
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Apr 09, 2009 4:50 pm    Post subject: Reply with quote

arvibala,

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                             
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//IN       DD *                                         
AAAA                                    111111111       
ZZZZ                                    111111111       
CCCC                                    111111111       
BBBB                                    222222222       
//OUT      DD SYSOUT=*                                 
//TOOLIN   DD *                                         
 SELECT FROM(IN) TO(OUT) ON(41,09,CH) FIRST USING(CTL1)
//CTL1CNTL DD *                                         
  SORT FIELDS=(41,09,CH,A,01,4,CH,A)                   
/*


Or you can use this sort step but this is based on assumption that your input file is FB 80 bytes LRECL
Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
AAAA                                    111111111       
ZZZZ                                    111111111       
CCCC                                    111111111       
BBBB                                    222222222       
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  OPTION EQUALS                                         
  SORT FIELDS=(41,9,CH,A,1,4,CH,A)                     
  OUTREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(41,9))       
  OUTFIL BUILD=(1,80),OMIT=(81,8,ZD,GT,1)               
/*                                                     

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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