View previous topic :: View next topic |
Author |
Message |
arvibala Beginner
Joined: 12 Feb 2008 Posts: 142 Topics: 67
|
Posted: Thu Sep 16, 2010 2:19 am Post subject: Get records with Max value |
|
|
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 |
|
|
Frank Yaeger Sort Forum Moderator
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Thu Sep 16, 2010 12:48 pm Post subject: |
|
|
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 |
|
|
arvibala Beginner
Joined: 12 Feb 2008 Posts: 142 Topics: 67
|
Posted: Fri Sep 17, 2010 12:55 am Post subject: |
|
|
Thanks You Frank _________________ Arvind
"You can make a difference with your smile. Have that with you always" |
|
Back to top |
|
|
Dhanush Banned
Joined: 18 Feb 2016 Posts: 4 Topics: 2 Location: Sydney, Australia.
|
Posted: Wed Mar 02, 2016 8:04 am Post subject: |
|
|
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 |
|
|
William Collins Supermod
Joined: 03 Jun 2012 Posts: 437 Topics: 0
|
Posted: Wed Mar 02, 2016 8:19 am Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Mar 02, 2016 10:36 am Post subject: |
|
|
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 |
|
|
|
|