Easytrieve BEFORE-LINE Statement

BEFORE-LINE is a special-name report procedure invoked immediately before the report writer prints each detail line defined by LINE statements. JOB logic and PRINT select which records appear; LINE declares column layout; BEFORE-LINE is your final edit pass on the values about to print. Change amounts for display masks, blank sensitive fields on certain rows, stamp run date on the first detail after a page overflow, or set annotation literals. When REPORT defines multiple LINE rows as a group, BEFORE-LINE runs before each individual line in that group—system field LINE-NUMBER tells you which row in the group is active. Format is BEFORE-LINE. PROC with END-PROC terminator, placed after the REPORT block. Do not PERFORM it. Legacy shops may still say BEFORE-DETAIL from IBM manuals; Broadcom 11.6 standardizes BEFORE-LINE. This page covers syntax, timing versus AFTER-LINE, LINE-NUMBER usage, FIRST-DETAIL patterns, interaction with REPORT-INPUT, and common beginner mistakes mixing detail hooks with break hooks.

Progress0 of 0 lessons

Statement Format

Broadcom Language Reference format is the reserved label BEFORE-LINE followed by PROC. Body contains Activity statements; END-PROC closes the procedure. Period after PROC label follows standard procedure naming grammar documented in PROC statement chapter.

text
1
2
3
4
5
BEFORE-LINE. PROC IF PAY-NET LT 0 PAY-NET = 0 END-IF END-PROC

Execution Timing in Report Cycle

For each record PRINT selects, report processing may run REPORT-INPUT, then BEFORE-LINE, then print LINE layout, then AFTER-LINE. BEFORE-LINE is the last opportunity to alter field values that LINE references. Calculations that affect break totals should occur in JOB logic or REPORT-INPUT before accumulation—not only in BEFORE-LINE after sums may have consumed prior values.

Detail versus break procedures
ProcedureWhen invokedTypical use
BEFORE-LINEBefore each detail line
AFTER-LINEAfter each detail line
BEFORE-BREAKBefore summary lines
AFTER-BREAKAfter summary lines

LINE-NUMBER and Line Groups

When REPORT specifies multiple LINE statements as a group, each physical print row gets its own BEFORE-LINE invocation. LINE-NUMBER holds the index of the line within the group—useful when line two needs different logic than line one on the same selected record. Test multi-line reports with DISPLAY of LINE-NUMBER during development then remove diagnostics before production.

Example: Conditional Detail Formatting

text
1
2
3
4
5
6
7
8
9
10
11
REPORT SALES-RPT LINESIZE 132 SEQUENCE REGION REP-NAME LINE 01 REP-NAME REGION GROSS-COMM BEFORE-LINE. PROC IF GROSS-COMM LT MIN-COMM FLAG-LINE = '** BELOW MINIMUM **' ELSE FLAG-LINE = SPACE END-IF END-PROC

FIRST-DETAIL and Break Context

Sites porting IBM documentation may use FIRST-DETAIL inside BEFORE-DETAIL procedures to detect first detail after control break or page overflow—useful for repeating headers or stamp dates only once per page. Broadcom 11.6 emphasizes BEFORE-LINE and field-class break tests such as DEPT BREAK. Combine IF FIRST-DETAIL or equivalent with SYSDATE assignment for run date on first detail line only. Verify keyword availability on your compiler—see deprecated constants tutorial for BEFORE-DETAIL migration.

Relationship to REPORT-INPUT

REPORT-INPUT runs when a record is selected for the report—before detail line construction. Use REPORT-INPUT for additional SELECT filtering or moving values into report work fields. Use BEFORE-LINE for last-millisecond display tweaks on the line about to print. Splitting concerns keeps REPORT-INPUT focused on data acceptance and BEFORE-LINE on presentation.

Literals and DISPLAY in BEFORE-LINE

Broadcom notes BEFORE-LINE can print literal strings before a detail line or change detail contents. DISPLAY to SYSPRINT during BEFORE-LINE floods diagnostic output—use sparingly. Prefer modifying LINE fields or dedicated annotation columns defined on LINE layout.

Restrictions

File GET and PUT may be restricted inside report PROCs depending on sort and report context. Avoid heavy I/O in BEFORE-LINE—keep per-row work CPU-light because it runs for every detail line on large extracts. Recursion and PERFORM of other PROCs follow general report PROC rules in your release manual.

Testing BEFORE-LINE

  1. Run small file with known outlier values triggering IF branches.
  2. Verify multi-line group invokes BEFORE-LINE per LINE-NUMBER expectation.
  3. Compare printed output before and after adding BEFORE-LINE logic.
  4. Confirm break totals unchanged when BEFORE-LINE only affects display fields.
  5. Regression-test legacy BEFORE-DETAIL label compile after rename to BEFORE-LINE.

Common BEFORE-LINE Mistakes

  • Using PERFORM to invoke BEFORE-LINE.
  • Placing BEFORE-LINE among job PROCs instead of after REPORT.
  • Confusing with BEFORE-BREAK summary hook.
  • Modifying key break fields accidentally before CONTROL sees them.
  • Heavy GET inside BEFORE-LINE on million-row report.
  • Assuming one BEFORE-LINE call per record when LINE group has multiple rows.

Explain It Like I'm Five

BEFORE-LINE is the last look at each row before the printer draws it. Like checking your homework one more time before the teacher reads it aloud. The report robot calls this automatically for every row—not you. You put the checking steps inside BEFORE-LINE recipe. AFTER-LINE is what you do right after the row appears on paper.

Exercises

  1. Write BEFORE-LINE zeroing negative PAY-NET before print.
  2. Explain LINE-NUMBER purpose for two-line LINE group.
  3. Contrast REPORT-INPUT versus BEFORE-LINE responsibilities.
  4. Migrate pseudocode from BEFORE-DETAIL label to BEFORE-LINE.
  5. List three test records for conditional FLAG-LINE logic.

Quiz

Test Your Knowledge

1. BEFORE-LINE. PROC runs:

  • Immediately before each detail line prints
  • Before control break totals
  • At compile time
  • After TERMINATION

2. LINE-NUMBER system field contains:

  • Which line in the line group is processing
  • JCL step number
  • File record count
  • Page count only

3. BEFORE-LINE is invoked by:

  • Report writer automatically
  • PERFORM from JOB
  • JCL only
  • OPEN statement

4. Legacy BEFORE-DETAIL naming should migrate to:

  • BEFORE-LINE on Broadcom 11.6
  • CLOSE
  • FILE
  • MACRO

5. BEFORE-LINE is the last chance to:

  • Modify detail line field contents before print
  • Define FILE in Library
  • Sort input
  • Link-edit program
Published
Read time16 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve Report Generator 11.6 BEFORE-LINE report procedureSources: Broadcom Easytrieve 11.6 Language Reference BEFORE-LINE, Report ProceduresApplies to: Easytrieve BEFORE-LINE report procedure