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
 

 

Get first record on Include

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

New User


Joined: 24 Jan 2007
Posts: 10
Location: USA

PostPosted: Fri Jan 14, 2011 9:41 pm    Post subject: Get first record on Include
Reply with quote

Hi,

I would like to get the first record on each key in the input file on a greater than condition.

i/p

p1 10
p1 20
p1 30
p2 10
p2 20
p2 30
p2 40
p3 10
p3 20
p3 40
p3 50

o/p - with > 20 condition
p1 30
p2 30
p3 40

Is this possible to do (FIRST) some how in the same > condition?

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

rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Fri Jan 14, 2011 9:55 pm    Post subject: Reply to: Get first record on Include
Reply with quote

If no. of steps is not a problem then a simple solution is

Step1 OMIT COND=(5,2,ZD,LE,20)

Step2
SORT FIELDS=(1,2,CH,A),EQUALS
SUM FIELDS=NONE

OOPs I missed same condition.
Back to top
View user's profile Send private message
Ajo

New User


Joined: 24 Jan 2007
Posts: 10
Location: USA

PostPosted: Fri Jan 14, 2011 10:02 pm    Post subject: Size of input is the issue
Reply with quote

Thank you. My question is - Is there a way I could skip to the next KEY after I get one record at the first condition?. (Not removing with duplicates on second step as the input file is too huge!!)

Or

Is there a way I could get just one record per key on a greater than condition? (not all the records that satisfy)
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Fri Jan 14, 2011 10:13 pm    Post subject:
Reply with quote

Is it like reporting 3rd record?
Back to top
View user's profile Send private message
Ajo

New User


Joined: 24 Jan 2007
Posts: 10
Location: USA

PostPosted: Fri Jan 14, 2011 10:24 pm    Post subject:
Reply with quote

> 20 is the condition
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jan 14, 2011 11:39 pm    Post subject: Reply to: Get first record on Include
Reply with quote

Ajo,

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 *                                           
P1 10                                                     
P1 20                                                     
P1 30                                                     
P2 10                                                     
P2 20                                                     
P2 30                                                     
P2 40                                                     
P3 10                                                     
P3 20                                                     
P3 40                                                     
P3 50                                                     
//OUT      DD SYSOUT=*                                     
//TOOLIN   DD *                                           
  SELECT FROM(IN) TO(OUT) FIRST ON(1,2,CH) USING(CTL1)     
//CTL1CNTL DD *                                           
  INCLUDE COND=(4,2,ZD,GT,20)                             
/*
Back to top
View user's profile Send private message
Ajo

New User


Joined: 24 Jan 2007
Posts: 10
Location: USA

PostPosted: Sat Jan 15, 2011 12:26 am    Post subject:
Reply with quote

Thank you icon_smile.gif , looks like I was using a KEEP parameter or a COPY which was giving me some error!
Back to top
View user's profile Send private message
Ajo

New User


Joined: 24 Jan 2007
Posts: 10
Location: USA

PostPosted: Sat Jan 15, 2011 1:34 am    Post subject:
Reply with quote

One more doubt. If the compare value field (20) is actually a PD with s9(9)V9(4) Comp-3,

do we write (4, 7,PD,GT,200000)? OR any other format is better?
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Sat Jan 15, 2011 2:06 am    Post subject:
Reply with quote

It would be (4, 7,PD,GT,+20)
Back to top
View user's profile Send private message
Ajo

New User


Joined: 24 Jan 2007
Posts: 10
Location: USA

PostPosted: Sat Jan 15, 2011 2:12 am    Post subject:
Reply with quote

Since the bytes after the decimal are 4, the above condition will not work (I think the default will be no decimal?)
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Sat Jan 15, 2011 2:23 am    Post subject:
Reply with quote

Did you tried this?
Back to top
View user's profile Send private message
Ajo

New User


Joined: 24 Jan 2007
Posts: 10
Location: USA

PostPosted: Sat Jan 15, 2011 2:25 am    Post subject:
Reply with quote

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

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Sat Jan 15, 2011 2:28 am    Post subject:
Reply with quote

So, you got incorrect results.Right?
Back to top
View user's profile Send private message
Ajo

New User


Joined: 24 Jan 2007
Posts: 10
Location: USA

PostPosted: Sat Jan 15, 2011 2:36 am    Post subject:
Reply with quote

yes, When I looked at the HEX data, I knew the SORT cannot know where decimal point will be!. it is 2 decimals or 4 or 6 and hence the compare will be just on bytes
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Jan 15, 2011 3:15 am    Post subject:
Reply with quote

Quote:
One more doubt. If the compare value field (20) is actually a PD with s9(9)V9(4) Comp-3,

do we write (4, 7,PD,GT,200000)?


It depends on what you mean by "compare value field (20)".

s9(9)v9(4) comp-3 would be stored internally as 13 digits and a sign. DFSORT does NOT know where the decimal point is.

So if you want a compare value of 20.0000, that would actually be stored internally as X'0000000200000C' and the constant would be 200000. If you want a compare value of 0.0020, that would be stored as X'0000000000020C', so the constant would be 20.
Back to top
View user's profile Send private message
Ajo

New User


Joined: 24 Jan 2007
Posts: 10
Location: USA

PostPosted: Sun Jan 16, 2011 7:26 am    Post subject:
Reply with quote

Thank you Frank! Good to hear from you after 5 years or so!!
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Jan 16, 2011 9:52 am    Post subject: Reply to: Get first record on Include
Reply with quote

Good to see you've found us again icon_smile.gif

Hopefully, we'll still be here if you don't get back for a few more years,

d
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
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 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


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