Page 1 on every sheet is a classic beginner bug—TITLE 03 'PAGE 1' looks fine in development until page two arrives in production with the same digit. Page numbers are dynamic report writer state, not literals frozen at compile time. As PRINT feeds records, the writer tracks how many lines TITLE headings, detail groups, SKIP gaps, and subtotals consumed on the current page. When PAGESIZE line budget exhausts, the writer ejects to a new page, reprints TITLE headings, and increments the page counter you reference in TITLE through a report function or system field exposed for pagination. CONTROL RENUM goes further—after a major break the next page not only ejects but restarts numbering at 1 so each region packet reads Page 1 of its section. Beginners tune detail without watching TITLE block height and wonder why pagination looks random; veterans calculate lines per employee group plus headings against PAGESIZE 58 or 60. This page teaches PAGESIZE versus LINESIZE, embedding page values in TITLE, RENUM interaction, report functions index cross-reference, and testing pagination on multi-page control reports.
123456REPORT PAY-RPT LINESIZE 132 PAGESIZE 60 TITLESKIP 2 TITLE 01 'ACME PAYROLL REGISTER' TITLE 02 'RUN DATE' RUN-DATE TITLE 03 'PAGE' + PAGE-FIELD LINE 01 EMPNO EMPNAME GROSS CONTROL DEPT
PAGESIZE sets lines per page; LINESIZE sets characters per line. PAGE-FIELD represents a working storage field assigned from report page function in TITLE processing or BEFORE-LINE—exact function name varies by release; consult report functions index and verify on your compiler listing. Pattern: literal PAGE plus dynamic field beats embedding static numbers.
| Consumer | Typical line cost |
|---|---|
| Each TITLE row | 1 per TITLE statement |
| TITLESKIP | N blank lines after TITLE block |
| LINE group height | Count of LINE 01, 02, ... in group |
| SKIP after group | REPORT SKIP value |
| Control subtotal lines | Per break level printed |
| CONTROLSKIP | After subtotal before detail |
Report functions chapter documents routines returning current page number and sometimes line number within page—use in TITLE, LINE, BEFORE-LINE, BEFORE-BREAK when pagination-aware logic is needed. Assign function result to W-type field in report procedure then reference field on TITLE for formatting with MASK. Do not call report functions expecting meaningful values in JOB body before first PRINT to that report—writer context may not exist yet.
Right-aligned page number: TITLE 03 RUN-DATE left literals, page field right via spacing literals or padded assignment in INIT-REPORT procedure. Page X of Y requires both page and total-pages functions if release provides total page estimate—some releases approximate; verify whether total pages is known only after report completes. Operational reports often settle on Page N only.
123456REPORT REGION-RPT PAGESIZE 58 TITLE 01 'REGIONAL PAYROLL' TITLE 02 'REGION' REGION-NAME ' PAGE' PAGE-FIELD LINE 01 EMPNO GROSS CONTROL REGION RENUM DEPT SUM GROSS
When REGION changes, RENUM on REGION ejects and sets next page number to 1. DEPT breaks within region continue incrementing page numbers until next region. Distribution teams mailing each region separately appreciate RENUM—each envelope starts at Page 1. Without RENUM, page numbers continue monotonically across regions—fine for single bound volume, confusing for per-region packets.
CONTROL NEWPAGE alone starts fresh page after break but preserves ascending page count—page 47 follows page 46 after region break. Choose NEWPAGE when visual separation matters but global page index must remain for legal exhibit numbering.
Page numbers are the page corner on your coloring book. The report robot draws pictures until the page is full, then flips to a new sheet and writes the next number in the corner. If you glue Page 1 sticker on every sheet yourself, every page lies. RENUM is starting the corner numbers over at 1 when you begin a brand-new chapter book inside the same binder.
1. Page numbers in TITLE typically use:
2. PAGESIZE on REPORT sets:
3. CONTROL field RENUM:
4. Hard-coding Page 1 in every TITLE causes:
5. Page numbers advance when: