MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
Dragon_Lee Beginner Joined: 13 Feb 2006 Posts: 31 Topics: 17
Posted: Tue Jul 03, 2007 8:55 pm Post subject: How to get the maximum rows with the same keys by DFSORT?
Hello again,
I want to sort another input file - this file has a key field and a description field - as the file below -
col.1-3 is the key and col 4-80 is the description
Code:
AAA 1213232321
AAA 321432432
BBB 2e1ew
BBB wewefsfdsf
The requirement is that if the key is same, then sort out the last row - so the output file of above is as below -
Code:
AAA 321432432
BBB wewefsfdsf
Can you please help me on this? Thanks a lot! _________________ Dragon
Back to top
Dragon_Lee Beginner Joined: 13 Feb 2006 Posts: 31 Topics: 17
Posted: Tue Jul 03, 2007 11:08 pm Post subject:
Seems this works -
Code:
INREC OVERLAY=(81:1,3)
OPTION EQUALS
SORT FIELDS=(1,3,CH,A)
OUTREC FIELDS=(1,83)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(81,3,TRAILER3=(1,80))
_________________ Dragon
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Wed Jul 04, 2007 8:00 am Post subject:
Dragon_lee,
you don't need INREC/OUTREC processing. This will do
Code:
//SYSIN DD *
OPTION EQUALS
SORT FIELDS=(1,3,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,3,
TRAILER3=(1,80))
/*
Or you can even use this
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
AAA 1213232321
AAA 321432432
BBB 2e1ew
BBB wewefsfdsf
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,3,CH) LAST
/*
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
Dragon_Lee Beginner Joined: 13 Feb 2006 Posts: 31 Topics: 17
Posted: Thu Jul 19, 2007 11:13 am Post subject:
The ICETOOL one looks cool! Thank you! _________________ Dragon
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