IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Get first record on Include


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 Developer


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

PostPosted: Sat Jan 15, 2011 3:15 am
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
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

Moderator Emeritus


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

PostPosted: Sun Jan 16, 2011 9:52 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top