Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

how to pull MAX value record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Jul 04, 2012 3:32 pm    Post subject: how to pull MAX value record
Reply with quote

Hi,

My input file (LRECL=80, RECFM=FB) has several records among which I want to pick records with MAX value present in it.

Input:
Code:

RECORDA01840
RECORDA01842
RECORDA01846
HOSANNA00001
HOSANNA00005
HOSANNA00006
HOSANNA00008


Expected Output:
Code:

RECORDA01846
HOSANNA00008


How to achieve it? Please help.

Thanks.
Back to top
View user's profile Send private message

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 785
Location: Chennai, India

PostPosted: Wed Jul 04, 2012 3:40 pm    Post subject:
Reply with quote

This link might be useful.

http://ibmmainframes.com/viewtopic.php?t=48595
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Jul 04, 2012 3:55 pm    Post subject:
Reply with quote

Do you need the output as in the same order of input file??
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 785
Location: Chennai, India

PostPosted: Wed Jul 04, 2012 3:58 pm    Post subject:
Reply with quote

Please try and let us know the results.

Code:
//TOOLIN   DD *                                                 
  SELECT FROM(IN1) TO(OUT) ON(1,7,CH) FIRST USING(CTL1)         
//CTL1CNTL DD *                                                 
 SORT FIELDS=(8,5,ZD,D)                                         
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Jul 04, 2012 4:09 pm    Post subject: Reply to: how to pull MAX value record
Reply with quote

wow.....thanks. icon_biggrin.gif
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Jul 04, 2012 4:11 pm    Post subject:
Reply with quote

Gnana Sekaran Nallathambi,

This control card wont work properly

for input like this

Code:

RECORDA01840
RECORDA01842
RECORDA01846
HOSANNA90001
HOSANNA00005
HOSANNA00006
HOSANNA90008
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 785
Location: Chennai, India

PostPosted: Wed Jul 04, 2012 4:17 pm    Post subject:
Reply with quote

Okay, Prem.

If ramsri confirms that is also a possible case and the desired output, please post SORT cards for the same.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Jul 04, 2012 4:25 pm    Post subject:
Reply with quote

Hi Ramsri,

This should help you if you need to retain the order

Code:

//OUTPUT    DD  DSN=&C2,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//OUTPUT2 DD SYSOUT=*
//TOOLIN   DD *
  SELECT FROM(INPUT) TO(OUTPUT) ON(1,7,CH) FIRST USING(CTL1)
  COPY   FROM(OUTPUT) TO(OUTPUT2) USING(CTL2)
//CTL1CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,ZD)
  SORT FIELDS=(1,7,CH,A,8,5,ZD,D)
//CTL2CNTL DD *
  SORT FIELDS=(81,8,ZD,A)
  OUTREC FIELDS=(1:1,80)


Hi Gnana,

You need to make use of feven 1,7 in your CTL1 so that the key doesnt get split into different sets and also the below code doesnt have the same order of input

Code:
//TOOLIN   DD *                                                 
  SELECT FROM(IN1) TO(OUT) ON(1,7,CH) FIRST USING(CTL1)         
//CTL1CNTL DD *                                                 
 SORT FIELDS=(1,7,CH,A,8,5,ZD,D)   
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Wed Jul 04, 2012 4:31 pm    Post subject:
Reply with quote

Hi Gnana,
Your solution is nice. But I think this
Quote:
//TOOLIN DD *
SELECT FROM(IN1) TO(OUT) ON(1,7,CH) FIRST USING(CTL1)
//CTL1CNTL DD *
SORT FIELDS=(8,5,ZD,D)

needs to be changed to
Code:
//TOOLIN   DD *                                                 
  SELECT FROM(IN1) TO(OUT) ON(1,7,CH) FIRST USING(CTL1)         
//CTL1CNTL DD *                                                 
    SORT FIELDS=(1,7,CH,A,8,5,CH,D) 
/*


Edited :S did not see previous post. contention
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Jul 04, 2012 7:00 pm    Post subject: Reply to: how to pull MAX value record
Reply with quote

thanks for all the responses.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us