Page 1 of 1

DUPKEYS MAX

PostPosted: Wed Oct 23, 2013 7:21 pm
by Prakash88
Hi,

I need to retrieve MAX records based on two columns.

Please find my input.
Input :
A Date1 30
A Date2 40
A Date2 50
B Date1 10
B Date1 20

//SYSIN DD *
SORT FIELDS=(1,1,CH,A)
DUPKEYS MAX=(3,5,CH,9,2,ZD)
/*

Expected output :
A Date2 50
B Date1 20

It is not allowing me to give two columns in DUPKEYS MAX . Please help me.

Re: DUPKEYS MAX

PostPosted: Wed Oct 23, 2013 7:28 pm
by NicC
You cannot do this with JCL and I presume you actually want to do it using your sort product. If this is so then let us know which sort product do you use and your post will be moved to the appropriate part of the forum.

Re: DUPKEYS MAX

PostPosted: Wed Oct 23, 2013 7:30 pm
by Akatsukami
Why would your output not contain
A Date1 30
?

Re: DUPKEYS MAX

PostPosted: Thu Oct 24, 2013 11:22 am
by Prakash88
I am using syncsort.

Why would your output not contain
A Date1 30

Assume date1 is day1. date2 is day2.
I always want to get latest date .

Re: DUPKEYS MAX

PostPosted: Thu Oct 24, 2013 11:56 am
by Prakash88
A slight change in the example given in my first post.

Input :
A Date1 70
A Date2 40
A Date2 50
B Date1 10
B Date1 20


Output :
A Date2 50
B Date1 10
B Date1 20

Can this be achieved using DUPKEYS command ?

Re: DUPKEYS MAX

PostPosted: Thu Oct 24, 2013 2:16 pm
by BillyBoyo
You need to show the full details of what you tried, including the sysout. In the Code tags, please.