View previous topic :: View next topic
|
Author |
Message |
Ajo
New User
Joined: 24 Jan 2007 Posts: 10 Location: USA
|
|
|
|
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 |
|
|
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
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 |
|
|
Ajo
New User
Joined: 24 Jan 2007 Posts: 10 Location: USA
|
|
|
|
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 |
|
|
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
Is it like reporting 3rd record? |
|
Back to top |
|
|
Ajo
New User
Joined: 24 Jan 2007 Posts: 10 Location: USA
|
|
|
|
> 20 is the condition |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
Ajo
New User
Joined: 24 Jan 2007 Posts: 10 Location: USA
|
|
|
|
Thank you , looks like I was using a KEEP parameter or a COPY which was giving me some error! |
|
Back to top |
|
|
Ajo
New User
Joined: 24 Jan 2007 Posts: 10 Location: USA
|
|
|
|
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 |
|
|
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
It would be (4, 7,PD,GT,+20) |
|
Back to top |
|
|
Ajo
New User
Joined: 24 Jan 2007 Posts: 10 Location: USA
|
|
|
|
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 |
|
|
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
Did you tried this? |
|
Back to top |
|
|
Ajo
New User
Joined: 24 Jan 2007 Posts: 10 Location: USA
|
|
|
|
yes.. |
|
Back to top |
|
|
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
So, you got incorrect results.Right? |
|
Back to top |
|
|
Ajo
New User
Joined: 24 Jan 2007 Posts: 10 Location: USA
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Ajo
New User
Joined: 24 Jan 2007 Posts: 10 Location: USA
|
|
|
|
Thank you Frank! Good to hear from you after 5 years or so!! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to see you've found us again
Hopefully, we'll still be here if you don't get back for a few more years,
d |
|
Back to top |
|
|
|