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.
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.
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.
123456REPORT PAY-RPT LINESIZE 132 TITLE 'PAYROLL REGISTER' TITLE 'PAGE ' PAGE-FUNCTION-RESULT LINE EMP-NO GROSS-EDIT DEPT
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.
| Concept | Purpose | Typical placement |
|---|---|---|
| Page number | Number each page of output | TITLE line |
| Line count | Lines used on current page | REPORT PROC break logic |
| Record sequence | Detail line number within break group | LINE or audit column |
| Report name context | Identify active report stream | Multi-report diagnostics |
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 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.
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.
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.
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.
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.
1. Report functions support:
2. Page number in TITLE often uses:
3. LINE count function helps:
4. Report functions differ from system $DATE because:
5. Using report function in JOB before REPORT defined: