Easytrieve Report Functions

Report functions speak the language of the report writer—page numbers, lines used on current page, record sequence within detail group—not the language of master files and arithmetic. TITLE line Page 12 of payroll register needs a function or special variable tracking pagination as PRINT selects rows. CONTROL break headers printing department name on new page may combine break field with page function so each dept starts fresh page when policy requires. LINE statements list detail columns; report functions answer meta questions about the listing itself. Easytrieve built its reputation on declarative REPORT subactivities; functions extend TITLE and REPORT PROC with dynamic values statements alone cannot derive. Beginners hard-code Page 1 in TITLE and wonder why every page shows one. Or confuse system date function with report run header date field—related but different sources. This index covers pagination counters, line counting versus LINESIZE, integration with CONTROL and SUM, REPORT PROC placement rules, formatted page literals, and fallbacks using manual counters in PROC when builtins unavailable on older compile levels.

Progress0 of 0 lessons

Report Writer Context

JOB logic issues PRINT REPORT-NAME when record qualifies. Report writer consults REPORT subactivity definition—TITLE, LINE, CONTROL, SUM—and formats output stream. Report functions evaluate in that context: page counter increments on page break; line counter resets when new page starts. Invoking page function outside active report processing yields undefined or compile-time restriction per grammar—use during PRINT-driven report activity only unless manual documents otherwise.

Page Number Functions

Current page function returns integer page within report—1 on first page, increments when report writer fills LINESIZE vertical space or explicit page advance triggers. TITLE second line often shows PAGE-NUM function result with literal Page prefix. Multi-report jobs maintain separate page sequences per REPORT name—page function scoped to active report. Restarting job mid-run resets page unless checkpoint facility preserves counters—rare in classic batch; expect page 1 on rerun.

text
1
2
3
4
5
6
REPORT PAY-RPT LINESIZE 132 TITLE 'PAYROLL REGISTER' TITLE 'PAGE ' PAGE-FUNCTION-RESULT LINE EMP-NO GROSS-EDIT DEPT

Line Count and LINESIZE

LINESIZE on REPORT sets logical line width; vertical line count determines page break when maximum lines per page reached—value from report options or default. Line function returns lines already printed on current page—useful in REPORT PROC to force break before footer overflow. Custom footer when LINE-COUNT GT 55 skip detail and print subtotal— pattern combining function with IF inside REPORT PROC. Misconfigured LINESIZE causes premature page breaks or spool lines wider than printer allows.

Report function concepts
ConceptPurposeTypical placement
Page numberNumber each page of outputTITLE line
Line countLines used on current pageREPORT PROC break logic
Record sequenceDetail line number within break groupLINE or audit column
Report name contextIdentify active report streamMulti-report diagnostics

Integration With CONTROL Breaks

CONTROL DEPT triggers subtotal and optional header when department changes. Page function may reset or continue across breaks depending on REPORT options—NEW PAGE ON CONTROL style parameters when documented. TITLE at break may repeat with updated break field and same page number sequence. SUM prints subtotals; page function does not replace SUM—it addresses pagination not aggregation. Sort input before CONTROL so breaks fire at value changes—function cannot fix unsorted control field.

REPORT PROC and Functions

REPORT PROC executes at control points—before break line, after line, custom totals. Functions inside REPORT PROC read live counters during formatting. Broadcom requires REPORT PROC immediately after REPORT subactivity referencing it—not mixed with job PROCs. Assign function result to working field then PRINT custom line from PROC when LINE statement insufficient for conditional layout.

Formatting Page and Line Values

Page number may be binary or packed; TITLE expects character. Assign PAGE-CHAR = EDIT or MOVE with numeric editing before TITLE references field name. Leading zeros on page numbers—Page 001 versus Page 1—business preference via picture mask on format step.

Multiple Reports in One Job

PRINT PAY-RPT and PRINT TAX-RPT each maintain pagination when REPORT definitions separate. Page function in PAY-RPT TITLE reads PAY-RPT counter; switching reports switches context. Do not assume global page across reports for consolidated PDF without merge post-processing.

Manual Counter Fallback

When page function unavailable, PROC increments WS-PAGE on explicit page break trigger— fragile versus report writer built-in. Prefer documented function when present. Manual count drifts if report writer inserts blank lines operator forgot to count.

Common Report Function Mistakes

  • Hard-coded page 1 in every TITLE line.
  • Using system date instead of report-specific run date field.
  • CONTROL on unsorted file—breaks and page headers wrong regardless of functions.
  • REPORT PROC placed after wrong REPORT subactivity.
  • LINESIZE mismatch with printer—lines wrap breaking line count logic.
  • Numeric page value in TITLE without character conversion.

Explain It Like I'm Five

Report functions are page numbers in your coloring book. The report writer turns pages when the page fills with detail lines. The function tells TITLE what page number to print at the top so nobody thinks every page is page one. Line count is how full the current page is before you need a new sheet.

Exercises

  1. Design two-line TITLE with report title and page number placeholder.
  2. Explain why CONTROL requires sorted input for correct breaks.
  3. Contrast report page function with system $DATE function.
  4. Describe REPORT PROC placement relative to REPORT subactivity.
  5. When would manual page counter be necessary?

Quiz

Test Your Knowledge

1. Report functions support:

  • Report writer pagination and counters during PRINT
  • FILE READ status only
  • JCL allocation
  • Macro pre-processing

2. Page number in TITLE often uses:

  • Report function returning current page
  • Packed employee ID
  • SORT key
  • PARM DEBUG

3. LINE count function helps:

  • Limit lines per page or trigger page break
  • Sort input file
  • Define FILE
  • Compile options

4. Report functions differ from system $DATE because:

  • They reflect report writer state not job clock
  • They are identical
  • Report functions JCL only
  • System functions PRINT only

5. Using report function in JOB before REPORT defined:

  • May compile but meaningless until PRINT activates report
  • Always invalid
  • Replaces FILE
  • Opens DD
Published
Read time14 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom report writer pagination patterns; function names per Application ReferenceSources: Broadcom Easytrieve 11.6 Activity Section Reporting, EZT Plus report functions indexApplies to: Easytrieve report writer built-in functions