Hello again. Thanks so much for all your much appreciated help.
I would like to use an internal SORT if possible in a program that generates five reports. I know that only one SORT statement is permitted. I can get around that by using a common area in the Sort Record for the Sort Key which has a Report Code as the first field, the rest of the Sort Key redefined as necessary.
However, this necessitates that the program generates multiple Sort Records per main loop.
I have two questions:
- The documentation states that when the program has nested loops, sort records are generated by the innermost loop. If there are loops (FINDs etc) in subroutines PERFORMed from the main loop, does SORT count these as nested loops for the purpose of generating sort records?
- Does SORT count FOR statements and the like as nested loops ?
- What’s a good way to generate multiple sort records per main loop - where IF statements would normally determine when to generate a sort record ?
Thanks so much for your help.