Using SORT in JCL, require only a maximum count after counting records group by

1.6k Views Asked by At

I have a problem, in which I need the max count after performing the group by count of records from position 1 to length 5, in a single step using SORT in JCL.

Tried with below JCL code, and was able to perform the group by count of records, but now only max count record is require, and tried MAX, but for every usage job abends.

Sample Data:

    AAAAA 234
    AAAAA 124
    BBBBB 324
    BBBBB 546
    AAAAA 325
    CCCCC 754
    BBBBB 546
    BBBBB 346
    CCCCC 765

SORT Control statement used in JCL Step:

    SORT FIELDS=(1,5,CH,A)
    OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(1,5,TRAILER3=(1,5,X,COUNT=(M10,LENGHT=4)))

Current output:

    AAAAA 3
    BBBBB 4
    CCCCC 2

Require output:

    BBBBB 4

Could anyone please help and suggest how I can use MAX along with SECTIONS, TRAILER and COUNT in single step.

0

There are 0 best solutions below