Handling Page Breaks
If a page break occurs within a group, you may want to reprint headings and the value of the break column at the top of the new page.
To control the printing of the value, use PRINT=CHANGE/TOP-PAGE. With this qualifier, the value of the ON-BREAK column is printed when it changes and after every page break. In this example, the value of state is printed not only when it changes, but whenever the report starts a new page.
To format records, use the NEXT-LISTING command. This command serves two purposes: the SKIPLINES=1 argument skips one line between records and then renumbers the current line as line 1; the NEED=4 argument prevents a listing from being split over two pages by specifying the minimum number of lines that are needed to write a new listing on the current page. In this case, if fewer than four lines are left on a page, SQR starts a new page.