Could someone suggest me how can achieve this in a cobol program.
You might be overlooking the simple fact that when dealing with MONEY quite often
the CALENDAR dates are not the same as LEDGER/ACCOUNTING dates
what about HOLIDAYS and similar ?
first get a better grasp of the RULES and a better description of the requirement
we do not need to know what You do after grouping the days ranges,
providing unneeded info just makes more difficult to understand the CORE requirement and give advice
where is that You are facing problems, anyway, the logic or the coding ?