A control report prints a total whenever a field such as department or line of business changes, then a grand total at the end. SEQUENCE keeps one value together. CONTROL names the break. SUM chooses which amounts land on the total line. Detail rows still come from LINE, for the records PRINT selected.
| Statement | Role |
|---|---|
| SEQUENCE | Order, major to minor, so one group finishes before the next |
| CONTROL | Which field change prints a subtotal |
| SUM | Which amounts accumulate. Omit it and every quantitative LINE field totals |
| LINE | The detail columns for each printed record |
123456789JOB INPUT PAYFILE PRINT PAY-RPT REPORT PAY-RPT LINESIZE 80 SEQUENCE DEPT CONTROL DEPT SUM GROSS TITLE 'SALARY EXPENSE BY DEPT' LINE DEPT EMPNAME GROSS NET-PAY DEDUCTIONS
NET-PAY and DEDUCTIONS still print on each detail row. Only GROSS is on the department total and on the FINAL line, because SUM says so.
State then ZIP is SEQUENCE STATE ZIP and CONTROL on both fields, state first. The ZIP total prints when ZIP changes. The state total prints when STATE changes, after the last ZIP in that state. Reverse the order and the outer total cuts a state in half.
You stack cards by color. Each time the color changes you write the count of the old color on a sticky note. SEQUENCE is stacking by color first. CONTROL is the moment the color changes. SUM is which numbers you add onto the sticky note. The last sticky note, after the box is empty, is the grand total.
1. A control break fires when:
2. SEQUENCE is required because:
3. SUM on a control report:
4. FINAL is:
5. Two-level breaks, state then ZIP, need: