Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 788
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: 1542
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: 788
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: 1542
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: 788
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: 1542
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: 1528
Location: Chennai

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 Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm
No new posts Format Last Record differently from r... Learncoholic DFSORT/ICETOOL 5 Tue Oct 24, 2017 12:01 pm
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us