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 

How to get the maximum rows with the same keys by DFSORT?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Dragon_Lee
Beginner


Joined: 13 Feb 2006
Posts: 31
Topics: 17

PostPosted: Tue Jul 03, 2007 8:55 pm    Post subject: How to get the maximum rows with the same keys by DFSORT? Reply with quote

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


Joined: 13 Feb 2006
Posts: 31
Topics: 17

PostPosted: Tue Jul 03, 2007 11:08 pm    Post subject: Reply with quote

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))

Very Happy
_________________
Dragon
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jul 04, 2007 8:00 am    Post subject: Reply with quote

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


Joined: 13 Feb 2006
Posts: 31
Topics: 17

PostPosted: Thu Jul 19, 2007 11:13 am    Post subject: Reply with quote

The ICETOOL one looks cool! Thank you!
_________________
Dragon
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 -> Utilities 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