Easytrieve AFTER-LINE

Detail lines are the body of every Easytrieve report—employee number, gross pay, department code aligned under TITLE headings. LINE statement declares column layout; report writer formats each selected record. AFTER-LINE is the report PROC hook firing immediately after each detail line prints—per-row logic that LINE static definition cannot express: increment audit sequence, print conditional footnote line when flag set, reset row-level edit field, or DISPLAY trace during development. BEFORE-LINE runs before the line; AFTER-LINE runs after—together they bracket detail output like bookends. Neither is PERFORMed from JOB. Both require END-PROC and placement directly after REPORT subactivity. Beginners put row filtering in AFTER-LINE when REPORT-INPUT or BEFORE-LINE is correct phase—line already on spool cannot be unsaid. This page teaches AFTER-LINE timing, practical use cases, interaction with CONTROL breaks, line counter patterns, restrictions on I/O, contrast with SUM and ADD, and testing with small PRINT samples.

Progress0 of 0 lessons

Detail Line Lifecycle

PRINT selects record. REPORT-INPUT may reject or modify. BEFORE-LINE adjusts fields or skips via SELECT inside PROC per grammar. LINE formats columns to report stream. AFTER-LINE executes post-print row logic. Control break events may interrupt sequence when CONTROL field changes—AFTER-LINE still per detail row within group. TERMINATION PROC once at report end.

Line-level versus break-level events
PROC nameHow often runs
BEFORE-LINEOnce per detail line before print
AFTER-LINEOnce per detail line after print
BEFORE-BREAKWhen control field changes—before new group
AFTER-BREAKAfter break totals for prior group

AFTER-LINE PROC Example

text
1
2
3
4
5
6
7
8
9
10
REPORT PAY-RPT TITLE 'PAYROLL DETAIL' LINE EMP-NO GROSS DEPT AFTER-LINE. PROC ADD 1 TO DETAIL-SEQ IF WARN-FLAG EQ Y LINE WARN-MSG END-IF END-PROC

DETAIL-SEQ increments every printed row—useful for audit FILE PUT mirroring sequence. WARN-MSG second LINE prints only when flag set—conditional supplemental row after main detail.

When to Use AFTER-LINE

  • Row sequence counters for audit trail files.
  • Conditional extra LINE rows trailing main detail.
  • Reset per-row working flags before next record.
  • Development DISPLAY replaced by comment before production.
  • Accumulate statistics not handled by SUM on same field.

When Not to Use AFTER-LINE

  • Filter records—use IF in JOB before PRINT or REPORT-INPUT PROC.
  • Department subtotals—use CONTROL and SUM.
  • Page titles—use TITLE statement.
  • Heavy calculations on raw file data—use JOB before PRINT.

BEFORE-LINE and AFTER-LINE Pairing

BEFORE-LINE masks sensitive field before print—SSN partial hide. AFTER-LINE logs sequence after visible line printed. Order guarantees BEFORE runs before formatter sees data; AFTER runs when line already committed to spool—plan audit accordingly.

Interaction With LINE and LINESIZE

Extra LINE inside AFTER-LINE consumes vertical space toward page break—may trigger ENDPAGE sooner than static layout expects. LINESIZE width still applies—long WARN-MSG wraps. Count supplemental lines when estimating lines per page for ops printer setup.

Side Effects and Field Mutation

Changing fields in AFTER-LINE affects next record if not reset—clear WARN-FLAG each iteration in JOB or start of REPORT-INPUT. Mutating GROSS in AFTER-LINE does not change line already printed but may corrupt SUM if writer reads field again—avoid unless documented behavior understood.

Common AFTER-LINE Mistakes

  • Filtering in AFTER-LINE instead of before PRINT.
  • PERFORM AFTER-LINE manually from JOB.
  • Missing END-PROC closing module.
  • Report PROC placed after wrong REPORT in multi-report program.
  • Unbounded extra LINE rows bloating spool volume.
  • File GET inside PROC violating report context restrictions.

Explain It Like I'm Five

Each detail line is one row in your report table. AFTER-LINE is what you do right after finishing one row—like putting a check mark in your notebook counting how many rows you drew. BEFORE-LINE is what you do before drawing the row—like picking the right color crayon.

Exercises

  1. Write AFTER-LINE PROC incrementing DETAIL-SEQ.
  2. Explain why record filtering belongs before PRINT not AFTER-LINE.
  3. Pair BEFORE-LINE mask with AFTER-LINE counter in pseudocode.
  4. Describe placement relative to REPORT subactivity.
  5. Contrast AFTER-LINE frequency with AFTER-BREAK frequency.

Quiz

Test Your Knowledge

1. AFTER-LINE PROC runs:

  • After each detail line prints
  • Before report starts only
  • At JCL initiation
  • Only on control break

2. AFTER-LINE is invoked by:

  • Report writer automatically
  • PERFORM from JOB
  • JCL SET
  • FILE OPEN

3. Use AFTER-LINE to:

  • Increment line counters or add trailing audit text
  • Define FILE layout
  • Sort input
  • Compile macros

4. AFTER-LINE versus AFTER-BREAK:

  • AFTER-LINE every detail row; AFTER-BREAK on control change
  • Same timing
  • AFTER-BREAK every line
  • Neither uses PROC

5. Report PROC placement for AFTER-LINE:

  • Immediately after REPORT subactivity
  • Before Library FILE
  • Inside IF only
  • JCL proc
Published
Read time14 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve 11.6 report PROC AFTER-LINE eventSources: Broadcom Activity Section Reporting, Procedures report eventsApplies to: Easytrieve AFTER-LINE report PROC