Easytrieve PAGE-NUMBER System Variable

PAGE-NUMBER is one of the report writer's built-in counters—a reserved system field you reference but never DEFINE. When PRINT drives a REPORT subactivity, the product tracks how many vertical lines TITLE headings, detail LINE groups, SKIP gaps, control totals, and footers consumed on the current sheet. When the PAGESIZE budget fills, the writer ejects, reprints headings, and bumps PAGE-NUMBER from 1 to 2 to 3 across the run. TITLE line three that says Page followed by PAGE-NUMBER therefore shows the live corner number operators expect on every sheet. Beginners who type the literal Page 1 in quotes ship a payroll register where page forty still says one—a classic audit failure. Veterans pair PAGE-NUMBER with CONTROL RENUM when each REGION must restart numbering at one inside the same physical print file. This page teaches read-only semantics, TITLE embedding, RENUM interaction, ENDPAGE procedure timing, differences from user counters and from PAGE-COUNT on some releases, and why JOB logic that reads PAGE-NUMBER before any PRINT may see meaningless values until the report stream activates.

Progress0 of 0 lessons

System Field, Not User Variable

System variables in Easytrieve arrive pre-defined by the product. You do not code DEFINE PAGE-NUMBER 9 or similar—the compiler treats PAGE-NUMBER as a reserved symbol with report-writer meaning. Attempting to declare your own field with that spelling produces duplicate symbol or unexpected keyword errors. Working storage alternatives like WS-PAGE-DISP are fine when you need to MASK or concatenate PAGE-NUMBER into a longer heading string before TITLE prints it. The system field remains the authoritative source; your W field is a copy for formatting only.

When PAGE-NUMBER Updates

Events that change PAGE-NUMBER
EventEffect on PAGE-NUMBERBeginner notes
First detail or heading on new reportUsually 1Starts fresh per REPORT name in the run
PAGESIZE line budget exhaustedIncrement by 1 on ejectTITLE reprints on new page
CONTROL field RENUMReset to 1 after breakAlso forces NEWPAGE
Explicit page advance in REPORT PROCMay increment per grammarConfirm on target release
JOB restarts mid-fileTypically back to 1Unless checkpoint facility preserves state

Using PAGE-NUMBER in TITLE

TITLE statements accept field names and literals in sequence. A common pattern places the report title on TITLE 01, run date on TITLE 02, and Page plus PAGE-NUMBER on TITLE 03. The report writer evaluates PAGE-NUMBER at format time for that heading line, so the value reflects the page about to print or currently printing depending on procedure timing—test with a fifty-line sample file locally. NOPAGE on TITLE suppresses the default page word the product might inject; you still reference PAGE-NUMBER explicitly when you want custom wording like Sheet instead of Page.

text
1
2
3
4
5
6
REPORT ACME-PAY LINESIZE 132 PAGESIZE 60 TITLESKIP 2 TITLE 01 'ACME PAYROLL REGISTER' TITLE 02 'RUN DATE' SYSDATE TITLE 03 'PAGE' PAGE-NUMBER LINE 01 EMPNO EMPNAME GROSS-PAY CONTROL DEPT

PAGESIZE and Line Consumers

PAGE-NUMBER does not advance on its own clock—it advances because something consumed vertical space. PAGESIZE sets how many lines fit on one page including headings. TITLESKIP adds blank lines after headings. Each detail LINE may span multiple print lines when masks wrap. SKIP after LINE inserts gaps. CONTROL break headers and SUM lines eat budget before the next employee row fits. Beginners set PAGESIZE 60 but stack four TITLE lines plus a fat CONTROL header and wonder why only forty detail rows appear per page; PAGE-NUMBER climbs faster because pagination triggers sooner. Tune headings and PAGESIZE together when PAGE-NUMBER-driven footers must align with operations standards.

CONTROL RENUM and Section Restarts

Regional payroll packets sometimes require Page 1 on every region cover even inside one spool dataset. CONTROL REGION RENUM starts a new page at the region break and resets PAGE-NUMBER to 1 for the following pages in that region section. Compare with NEWPAGE alone, which ejects without necessarily resetting the counter—RENUM combines both behaviors per Broadcom CONTROL documentation. Mis-applying RENUM on a low-level break like DEPARTMENT restarts numbering every few lines and confuses recipients who expected continuous pages across the enterprise file.

PAGE-NUMBER Versus Report Functions

Report function index pages document built-in routines that return page-related values. PAGE-NUMBER as a system field is the declarative counterpart—you place the name directly in TITLE without function-call punctuation on many grammars. Some installations standardize on one style for readability. PAGE-COUNT appears in alternate examples especially with REPORT NOPAGE custom headers; timing in TITLE versus ENDPAGE can differ by release—log ambiguous compile listings and verify on your 11.6 or Plus compiler before production cutover.

PAGE-NUMBER Versus User Counters

Teams sometimes ADD 1 TO WS-PAGE in a REPORT PROC to mimic pagination when migrating legacy code. Prefer PAGE-NUMBER when the report writer already maintains the counter—manual counters drift when SKIP, TITLESKIP, or CONTROL lines change. User counters remain valid for non-REPORT DISPLAY output or audit logs outside the declarative report stream. Never name the user counter PAGE-NUMBER; prefix with WS- or RPT-.

ENDPAGE and Procedure Timing

ENDPAGE. PROC runs at page boundaries. Developers test PAGE-NUMBER inside ENDPAGE to print end-of-page subtotals or footers that must appear only when the page fills. Reading PAGE-NUMBER in BEFORE-LINE shows the page active while detail lines stream. JOB INPUT logic that DISPLAYs PAGE-NUMBER before any PRINT to the report usually shows zero or an uninitialized pattern—move diagnostic DISPLAY into REPORT-INPUT or TERMINATION when validating pagination during development.

Multi-Report Jobs

One program may define REPORT ALPHA and REPORT BETA with separate PRINT statements. PAGE-NUMBER scopes to the report currently printing—ALPHA page 5 does not continue into BETA page 6 unless your flow intentionally chains them and the product shares counters per release rules. Document per-report pagination in job design specs when operations merge spool files by REPORT name.

Common PAGE-NUMBER Mistakes

  • Literal Page 1 in TITLE on every heading line.
  • DEFINE PAGE-NUMBER as a user field.
  • Expecting PAGE-NUMBER in batch JOB before PRINT activates the report.
  • RENUM on the wrong CONTROL break level.
  • Ignoring TITLESKIP and CONTROL lines when tuning PAGESIZE.
  • Mixing PAGE-NUMBER and PAGE-COUNT without release verification.

Explain It Like I'm Five

PAGE-NUMBER is the little number in the corner of your coloring book page. The report robot draws pictures until the page is full, then flips to a new sheet and writes the next corner number. You do not make your own corner-number sticker named PAGE-NUMBER—the robot already has one. If you glue a Page 1 sticker on every sheet yourself, every page lies. RENUM is when the robot starts counting from one again because you began a brand-new chapter in the same book.

Exercises

  1. Write TITLE 03 with literal PAGE and PAGE-NUMBER for a payroll report.
  2. Explain when CONTROL REGION RENUM resets PAGE-NUMBER versus NEWPAGE only.
  3. List four line types that consume PAGESIZE budget before detail prints.
  4. Contrast PAGE-NUMBER with a WS-PAGE user counter and when each is appropriate.
  5. Describe the bug when TITLE hard-codes Page 1 on a fifty-page file.

Quiz

Test Your Knowledge

1. PAGE-NUMBER is maintained by:

  • Report writer during PRINT
  • JCL COND
  • FILE DCB
  • MACRO expansion

2. You should NOT DEFINE a user field named PAGE-NUMBER because:

  • It is a reserved system field
  • It is too long
  • Only COBOL allows it
  • JCL blocks it

3. CONTROL field RENUM affects PAGE-NUMBER by:

  • Starting new page and resetting counter to 1
  • Deleting detail lines
  • Closing SYSPRINT
  • Skipping SORT

4. PAGE-NUMBER in JOB logic before PRINT may:

  • Be zero or meaningless until report is active
  • Always equal SYSDATE
  • Replace FILE-STATUS
  • Open output DD

5. Hard-coding Page 1 in TITLE instead of PAGE-NUMBER causes:

  • Same digit on every page
  • Compile failure
  • SORT error
  • FILE not found
Published
Read time16 min
AuthorMainframeMaster
Reviewed by MainframeMaster teamVerified: Broadcom Easytrieve 11.6 Symbols PAGE-NUMBER, REPORT paginationSources: Broadcom Easytrieve 11.6 Symbols and Reserved Words, REPORT Statement, CONTROL RENUMApplies to: Easytrieve PAGE-NUMBER system variable