Easytrieve Control Breaks

Payroll by department. Sales by region and branch. Inventory by warehouse and aisle. Each pattern shares one idea: when a grouping field changes, the report should subtotal the prior group before continuing. Easytrieve encodes that in the CONTROL statement inside a REPORT subactivity. CONTROL names non-quantitative fields—DEPT, REGION, ZIP—that trigger breaks when values change. The report writer compares each new detail record to the prior control field values; on mismatch it fires break processing: accumulate final values for the closing group, print subtotal lines, optionally start a new page, invoke BEFORE-BREAK and AFTER-BREAK procedures, reset counters for the new group, and continue detail printing. Major-to-minor field order defines hierarchy: REGION breaks encompass many BRANCH breaks within the same region. Beginners print beautiful detail lines but see subtotals in wrong places because input was not sorted into CONTROL sequence—breaks only fire on adjacent record comparison, not global resorting. This page teaches CONTROL syntax, FINAL and NEWPAGE options, LEVEL semantics, SEQUENCE cooperation, SUMCTL printing of control values on total lines, and debugging multi-level control reports.

Progress0 of 0 lessons

CONTROL Statement Format

text
1
2
3
4
5
REPORT PAY-RPT LINESIZE 132 TITLE 01 'PAYROLL BY DEPARTMENT' LINE 01 DEPT EMPNO EMPNAME GROSS CONTROL FINAL NEWPAGE REGION NEWPAGE BRANCH DEPT SUM GROSS

FINAL may appear first with its own NEWPAGE, RENUM, or NOPRINT options for grand totals at end-of-report. Each field-name is a break key. NEWPAGE after REGION starts a fresh page after region subtotals complete. RENUM also resets page number to 1. NOPRINT accumulates without printing that level's subtotal line group.

Major-to-Minor Hierarchy

Three-level control example
Break levelCONTROL fieldBreak fires when
Major (highest)REGIONREGION value changes between records
MinorBRANCHBRANCH changes within same REGION
More minorDEPTDEPT changes within same BRANCH
FINAL(end of report)After last detail record processed

When DEPT changes, level-3 break runs. When BRANCH changes, levels 3 and 2 may both process—DEPT and BRANCH subtotals in minor-to-major order per report writer rules. When REGION changes, all lower levels close. Understanding order prevents duplicate subtotal lines when you add fields without re-sorting input.

LEVEL and BREAK-LEVEL

System field LEVEL in BEFORE-BREAK and AFTER-BREAK procedures identifies which break level is active—1 for lowest CONTROL field, higher numbers for outer levels, special handling for FINAL. BREAK-LEVEL records the highest field that broke on this boundary. Use IF LEVEL = 1 to format zip-code subtotals differently from state-level totals in one shared BEFORE-BREAK procedure. Field HIGHEST-BREAK tests on control field names tell you whether a specific field triggered the current break pass.

Sorting and SEQUENCE

CONTROL compares consecutive report input records. If record 5 has DEPT 100 and record 6 has DEPT 200 but record 7 returns to DEPT 100, you get two DEPT 100 groups—not one combined group. Fix input with SORT activity USING keys matching CONTROL order, or ensure upstream extract is presorted. REPORT SEQUENCE statement may reference control fields to document expected order and interact with report writer sequencing options on your release—still not a substitute for physically sorted files.

CONTROL Break Processing Flow

  1. PRINT selects record for report input.
  2. Report writer compares control field values to prior record.
  3. On change: run AFTER-BREAK (if coded), print subtotal lines, BEFORE-BREAK for next level, reset accumulators for new group.
  4. Print detail LINE group for current record.
  5. At EOF: FINAL break processes grand totals.

NEWPAGE and RENUM

NEWPAGE after a control field forces top-of-page after that field's break processing completes—common after REGION so each region starts on a fresh page. RENUM adds page number reset to 1 on the following page—useful when each region is distributed as a standalone packet. Excessive NEWPAGE on low-level DEPT breaks wastes paper; apply NEWPAGE to major levels only unless policy requires page per department.

NOPRINT Break Level

NOPRINT on CONTROL BRANCH suppresses printing subtotal lines for branch breaks while still accumulating amounts feeding region and FINAL totals—handy when only region and grand totals appear on paper but branch math must remain correct internally. NOPRINT does not skip BEFORE-BREAK procedures; Broadcom documents BEFORE-BREAK still runs even when NOPRINT hides total lines.

SUMCTL and Total Line Content

REPORT SUMCTL controls how control field values appear on subtotal lines—ALL prints control values on every total line, HIAR hierarchical display, NONE suppresses control value repetition, TAG annotates lines. DTLCOPY prints detail field contents on level-1 total lines. List control fields first on LINE statements when you want break keys adjacent to SUM amounts on subtotal rows.

REPORT SUMMARY Control-Only Reports

REPORT SUMMARY inhibits detail LINE printing—only control totals appear. Combined with CONTROL hierarchy you produce management rollup with no employee detail. SUMMARY differs from NOPRINT: SUMMARY removes all detail lines globally; NOPRINT targets one break level's subtotal line group.

Common Control Break Mistakes

  • Unsorted input—scattered duplicate break groups.
  • Quantitative field on CONTROL—use non-quantitative break keys.
  • Minor field listed before major field—wrong hierarchy.
  • Expecting global subtotal across non-adjacent same key values.
  • Ignoring BEFORE-BREAK for percentages needing finalized SUM.

Explain It Like I'm Five

Control break is noticing the color of folder changed in a stack of papers. When color changes, you add up all papers of the old color before starting the new pile. CONTROL tells Easytrieve which label to watch—department color, region color. Major color is the big state; minor color is city inside the state. If papers are shuffled out of order, the adding machine gets confused—sort the stack first.

Exercises

  1. Write CONTROL REGION BRANCH DEPT with NEWPAGE on REGION only.
  2. Explain why unsorted DEPT breaks mis-subtotal.
  3. Use LEVEL in pseudocode BEFORE-BREAK for level-1 only message.
  4. Contrast NOPRINT and REPORT SUMMARY.
  5. Match SORT USING keys to a three-level CONTROL list.

Quiz

Test Your Knowledge

1. A control break occurs when:

  • Any CONTROL field value changes or at end of report
  • Every PRINT statement
  • JOB starts
  • FILE opens

2. CONTROL fields must be listed in:

  • Major-to-minor order
  • Alphabetic field name order
  • Random order
  • Descending length only

3. LEVEL system field in BEFORE-BREAK indicates:

  • Which break level is currently processing
  • JCL return code
  • Record length
  • Screen row

4. CONTROL DEPT NOPRINT:

  • Accumulates break but suppresses subtotal line print
  • Skips all detail
  • Compile error
  • Disables SUM

5. Input file for control reports should be:

  • Sorted into CONTROL field sequence
  • Unsorted random order
  • SQL only
  • Empty
Published
Read time18 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve 11.6 CONTROL Statement and Control Reports chapterSources: Broadcom Easytrieve 11.6 CONTROL Statement, Control Reports, BEFORE-BREAKApplies to: Easytrieve CONTROL control break reports