Page 1 of 2

Use DUPKEYS with OUTFIL

PostPosted: Tue Feb 18, 2014 9:28 pm
by gabrielp
I have an step thar I want 2 files out. Fisrt of them i'd like all regs sorted. The second one, i'd like all regs sorted but, i'd like the maximiun value of (05,26) for each duplicated keys.

can I do it this way?


SORT FIELDS=(01,04,BI,A)
OUTFIL FILES=01,
OUTREC=(01,50)
OUTFIL FILES=02,
DUPKEYS MAX=(05,26,BI)

thanks

Re: Use DUPKEYS with OUTFIL

PostPosted: Tue Feb 18, 2014 10:42 pm
by BillyBoyo
No, but have look at OUTFIL reporting features,

Re: Use DUPKEYS with OUTFIL

PostPosted: Tue Feb 18, 2014 10:57 pm
by gabrielp
do you know any other way do do this in 1 sept?

Re: Use DUPKEYS with OUTFIL

PostPosted: Wed Feb 19, 2014 12:42 am
by dick scherrer
Hello and welcome to the forum,

do you know any other way do do this in 1 sept?
i do not understand what this is asking . . . :?
Please clarify.

d

Re: Use DUPKEYS with OUTFIL

PostPosted: Wed Feb 19, 2014 7:37 pm
by gabrielp
do you know how can i do it (I want 2 files out. Fisrt of them i'd like all regs sorted. The second one, i'd like all regs sorted but, i'd like the maximiun value of (05,26) for each duplicated keys.) using only one step.

Re: Use DUPKEYS with OUTFIL

PostPosted: Thu Feb 20, 2014 12:53 am
by dick scherrer
Hello,

You really need to make sure of the spelling of what you post. . . . The 1 sept was a mystery . . .

I suppose regs are records?

Suggest you post some sample input data and the outputs you want from that sample input.

Re: Use DUPKEYS with OUTFIL

PostPosted: Thu Feb 20, 2014 1:17 am
by gabrielp
input
0001gabriel20
0001gabriel50
0001gabriel30
0002roberta10
0002roberta60
0002roberta20


output1:
0001gabriel20
0001gabriel30
0001gabriel50
0002roberta10
0002roberta20
0002roberta60

output2:
0001gabriel50
0002roberta60

Re: Use DUPKEYS with OUTFIL

PostPosted: Thu Feb 20, 2014 3:19 am
by Thampy
You can use OUTFIL SECTIONS to achieve the result you are looking for.

//STEP010 EXEC PGM=SORT
//SORTIN DD *
0001GABRIEL20
0001GABRIEL50
0001GABRIEL30
0002ROBERTA10
0002ROBERTA60
0002ROBERTA20
//SORTOF1 DD SYSOUT=*
//SORTOF2 DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,13,CH,A)
OUTFIL FILES=1,BUILD=(1,80)
OUTFIL FILES=2,REMOVECC,NODETAIL,SECTIONS=(1,4,
TRAILER3=(1,13))
//*


SORTOF1 output
0001GABRIEL20
0001GABRIEL30
0001GABRIEL50
0002ROBERTA10
0002ROBERTA20
0002ROBERTA60

SORTOF2 output
0001GABRIEL50
0002ROBERTA60

Re: Use DUPKEYS with OUTFIL

PostPosted: Thu Feb 20, 2014 12:59 pm
by BillyBoyo
Yes, but are you going to show the use of MAX?

Re: Use DUPKEYS with OUTFIL

PostPosted: Thu Feb 20, 2014 6:26 pm
by gabrielp
yes MAX