You asked and then went "away" for five days. You didn't show anything you tried when you came back, and now...
Anyway, if you "extend" your record by adding a value of "one" to the end (if fixed-length) of the record, then SUM on that extended "one".
The "one" can be of the form C'01', C'001', C'0001' etc depending on how many records are the maximum you can ever expect on your file (I'd always go "10 times bigger").
After the SUM, in OUTREC for instance, use BUILD to get rid of the extension.
EG. If you record is 80-bytes fixed and you can expect up to 87000 records,
SORT (your sort keys)
The Xs represent one blank, and are just for spacing the output in this example.