Control breaks split reports into department sections, region subtotals, and account groupings. SUM prints subtotal amounts when CONTROL field value changes. AFTER-BREAK is the report PROC hook that runs immediately after the report writer finishes break processing for the prior group—after subtotals landed, before detail for the next group continues or before final grand totals depending on event order documented for your release. Use AFTER-BREAK to print dashed separator lines, audit messages, reset working flags, or apply formatting SUM cannot express. It is not PERFORMed from JOB logic—the report engine calls it by reserved name exactly like BEFORE-BREAK and AFTER-LINE. Placement immediately after REPORT subactivity is mandatory; mixing among job PROCs causes compile errors. Beginners enable CONTROL on unsorted files and debug AFTER-BREAK when root cause is input order. This page teaches AFTER-BREAK timing in report lifecycle, pairing with CONTROL and SUM, contrast with BEFORE-BREAK, allowed statements inside PROC, side effects on fields referenced by LINE, and testing with small sorted samples.
PRINT selects record for report. REPORT-INPUT PROC may filter further. Detail LINE prints for each record. When CONTROL field changes, BEFORE-BREAK may print heading for new group. Break subtotals from SUM emit. AFTER-BREAK PROC runs post-break—ideal for trailing dashes, blank line, or resetting break-level edit flags. Sequence exact order consult Language Reference—do not assume BEFORE always before SUM without verifying release.
| Event PROC | Typical timing |
|---|---|
| REPORT-INPUT | Per selected record before detail |
| BEFORE-LINE | Before each detail line |
| AFTER-LINE | After each detail line |
| BEFORE-BREAK | Before new control group output |
| AFTER-BREAK | After control break totals for prior group |
| TERMINATION | Report completion |
12345678910REPORT DEPT-RPT CONTROL DEPT SUM GROSS TITLE 'DEPARTMENT PAYROLL' LINE EMP-NO GROSS DEPT AFTER-BREAK. PROC SEP-LINE = '------------------------' LINE SEP-LINE END-PROC
CONTROL DEPT declares break field. SUM GROSS accumulates per DEPT group. AFTER-BREAK adds presentation logic SUM does not cover—optional footnote LINE with literal text, DISPLAY to SYSPRINT for debug during development only. Do not re-SUM in AFTER-BREAK unless intentional double-count for audit—SUM already updated break totals.
Input must be sorted on CONTROL field—or report must SORT internally when grammar supports SORT before report phase. Unsorted DEPT values produce break on every row change back and forth—AFTER-BREAK fires constantly with meaningless subtotals. Verify sort keys match CONTROL field type and collating sequence.
BEFORE-BREAK prints new department banner before detail lines of new group. AFTER-BREAK cleans up after prior group totals printed. Some layouts need only one; some need both— banner before, separator after. Test spool output with two departments and three employees each to see event order visually.
MOVE, assignment, MASK, additional LINE via fields, conditional IF on break level flags. Avoid heavy file I/O restricted by manual. Side effect: changing field AFTER-BREAK uses on next detail LINE affects subsequent rows—document mutations. Keep AFTER-BREAK short for maintainability.
A control break is when the report starts a new section because the department name changed. AFTER-BREAK is what you do right after finishing the math for the old section— like drawing a line under the subtotal before starting the next department. The report machine calls AFTER-BREAK for you when it notices the department changed.
1. AFTER-BREAK is:
2. AFTER-BREAK PROC must be placed:
3. CONTROL on DEPT field with AFTER-BREAK typically needs:
4. AFTER-BREAK compared to BEFORE-BREAK:
5. PERFORM AFTER-BREAK manually: