I have following sort-problem :
I perform a sort on a number of fields in a dataset, which gives me a number of 'blocks' with similar sort fields. Now I need to count the number of records in these blocks and use this number as a new sort criteria.
eg. after my inital sort I have following file (sorted on char 1 and 2)
AAxxxx
AAxxxx ---- AA has 2 records
ABxxxx ---- AB has 1 record
BAxxxx ---- BA has 1 record
BBxxxx
BBxxxx ---- BB has 2 records
now I need to resort with criteria (char1 / # of records (desc) /char2) which should result in
AAxxxx
AAxxxx
ABxxxx
BBxxxx
BBxxxx
BAxxxx
how do I count the records in my 'blocks' and use this as a sort-criterium ???
I read DFSORT and ICETOOLS manuals but found nothing to help me.
I could write a small program to add #records after initial sort but I'd prefer to do this in JCL ...
any help is greatly appreciated !