CIS133C CLASS 15
A single level control break is a break or pause in processing triggered by a change in the value of a specified data field that prompts the program to print out a total at one level.
CONTROL BREAK PROCESSING . . .
- For the first record read, move the control field to a hold area in WORKING-STORAGE then process the record (format and print the detail record, accumulate to the next level and read the next record.
- For each additional record do one of the following and then read the next record . . .
- process the record as long as the current control field is EQUAL to the hold field
- perform a control break when the current control field is NOT EQUAL to the hold field.
- At end of file perform a control break to print the last control group totals then print system or grand totals.
The following is a list of things you must remember to do when a control break occurs (current record control field value is not equal to previous record or hold control field value) . . .
- The control break total or totals must be output.
- Accumulate to the next level.
- Initialize the control total(s) to zero.
- Process the record.
- Move the current control field to the hold or previous control field.
Background gif from . . .
|