Hi YGrunt,
You didn't show us the write stmts you use to print the lines of your report, so I assume you're using the
WRITE AFTER ADVANCING .... form.
Here's the usual algorithm:
Code:
IF PG-LINES-WRITTEN > 65 (or whatever)
OR
PG-BREAK-SW-IS-SET
WRITE RPT-REC
FROM RPT-HDR AFTER ADVANCING PAGE
MOVE 0 TO PG-LINES-WRITTEN
ADD 1 TO PG-NBR
END-IF
WRITE RPT-REC
FROM RPT-DETAIL AFTER ADVANCING 1 LINE
ADD 1 TO PG-LINES-WRITTEN
The intent of this code is to determine:
1) If the page is full
2) If you previously detected a situation where a new page is required (page break).
If either of these conditions is present, a heading line is printed on a new page and the counters are adjusted before the detail line is printed.
If they aren't, only the detail need be printed.
Notice, there's no need to fill the rest of the page with blank lines; that's what the AFTER ADVANCING PAGE clause is for. It "jumps" to the top of the next page before printing the line.
What I showed here is a "stripped down" version of what you may have to do (e.g., print multiple heading lines, etc.); you might even want to PERFORM a "start new page" pgraph.
But it presents the main idea: you can force a page break "jump" by using the AFTER ADVANCING PAGE clause.