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 

Get records with Max value

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


Joined: 12 Feb 2008
Posts: 142
Topics: 67

PostPosted: Thu Sep 16, 2010 2:19 am    Post subject: Get records with Max value Reply with quote

Hi,

I have a file which has Account number and Sequence number as below

Code:


111111     030
111111     070
111111     080
111111     090
111112     032
111112     039
111112     040
111112     042



I want the output to be single account number with highest sequence number. In the above example it will be

Code:


111111     090
111112     042



I searched the site and got the below solution

http://www.mvsforums.com/helpboards/viewtopic.php?t=3672&highlight=max

Since the response was in 2005, I am looking for reply with more simple sort logic.
_________________
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
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Sep 16, 2010 12:48 pm    Post subject: Reply with quote

arvibala,

Use the following DFSORT/ICETOOL JCL which will give you the desired results


Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                     
//DFSMSG   DD SYSOUT=*                                     
//IN       DD *                                             
111111     030                                             
111111     070                                             
111111     080                                             
111111     090                                             
111112     032                                             
111112     039                                             
111112     040                                             
111112     042                                             
//OUT      DD SYSOUT=*                                     
//TOOLIN   DD *                                             
  SELECT FROM(IN) TO(OUT) ON(1,6,CH) FIRST USING(CTL1)       
//CTL1CNTL DD *                                             
  SORT FIELDS=(1,6,CH,A,12,3,ZD,D)                         
//*

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


Joined: 12 Feb 2008
Posts: 142
Topics: 67

PostPosted: Fri Sep 17, 2010 12:55 am    Post subject: Reply with quote

Thanks You Frank
_________________
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
Dhanush
Banned


Joined: 18 Feb 2016
Posts: 4
Topics: 2
Location: Sydney, Australia.

PostPosted: Wed Mar 02, 2016 8:04 am    Post subject: Reply with quote

Hi,

what if I have to find max when I have to do SUMFIELDS along?

When we have SUMFIELD in place, giving sort field with descending will not help as it could that the descending field as well a key for removing duplicates.
_________________
- Dhanush M
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Wed Mar 02, 2016 8:19 am    Post subject: Reply with quote

You should ask a new question, not tail-gate an old one.

What do you mean by SUMFIELDS? What do you mean by your question, it is very unclear at the moment?
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 Mar 02, 2016 10:36 am    Post subject: Reply with quote

Dhanush wrote:
Hi,

what if I have to find max when I have to do SUMFIELDS along?

When we have SUMFIELD in place, giving sort field with descending will not help as it could that the descending field as well a key for removing duplicates.


Dhanush,

What ever happened to the questions you posted in this topic?

http://www.mvsforums.com/helpboards/viewtopic.php?p=61409#61409
_________________
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 -> 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