MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
arvibala Beginner Joined: 12 Feb 2008 Posts: 142 Topics: 67
Posted: Thu Apr 09, 2009 3:58 pm Post subject: Sort on 2 fields but remove duplicate on one field.
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Thu Apr 09, 2009 4:50 pm Post subject:
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
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