Internet COBOL
Two level control
break
Using lab 10, extend the processing, so that you have a two level control break. You will break when the level changes (minor break - the current levels are: A, B, and C) and when the state changes (major break).
On the minor break, you will print the number of salespeople at the level.
On the major break, you will print out the totals for that state.
My suggestions for the 3000-PROCESS (pseudocode):
3000-PROCESS. IF STATE-IN <> PREVIOUS-STATE PERFORM 3500-SUMMARY PERFORM 3600-SETUP END-IF. IF LEVEL-IN <> PREVIOUS-LEVEL PERFORM 3550-LEVEL-BREAK PERFORM 3650-LEVEL-SETUP END-IF.
Regular processing Read next recordat end . . .
. . .
3500-SUMMARY PERFORM 3550-LEVEL-BREAK. do whatever is needed on the state break, such as moving data to output lines, adding totals to grand-totals, and writing the summary lines.
3550-LEVEL-BREAK. do whatever is needed on the level break - including adding the level totals to the state-totals, and writing level break summary lines
3600-SETUP.
MOVE STATE-IN TO PREVIOUS-STATE. MOVE STATE-IN TO STATE-NAME-HL (heading-line) MOVE ZERO TO various totals. ADD 1 TO PAGE-COUNT (and other heading processes). WRITE REPORT-RECORD FROM HEADING-LINE(S). PERFORM 3650-LEVEL-SETUP.
3650-LEVEL-SETUP. MOVE LEVEL-IN TO PREVIOUS-LEVEL. MOVE ZERO TO the various level total fields. if needed, write a level heading line.