Pagination in Reports
Pagination in the report is controlled by a number of statements. The .pagelength statement specifies the vertical size of pages, in lines, while the .pagewidth specifies the horizontal size of pages, in characters. Statements are used in the page header and footer sections to define actions to be taken at the beginning and end of each page. Use the .newpage and .need statements to force page breaks, and the .formfeeds statement to instruct Report-Writer to send a formfeed character to the printer after printing all lines that fit on the defined page. Line numbering begins at 1 (top line).
Before Report-Writer begins to print a report, it calculates the number of lines in the page header and footer you have specified. After printing each line, it compares the specified or default page length with the number of lines already printed. If there are only enough blank lines left to write the page footer, Report-Writer prints the page footer, issues a formfeed character (if specified) for a page break, updates the page number, and prints the page header for the next page.
If the .formfeeds statement is in effect, Report-Writer inserts the formfeed character at the start of the report and at the end of each page. In some cases, the .formfeeds statement is not needed. For instance, the .print statement automatically inserts formfeeds appropriate for 11‑inch paper if you use the default page length (61 lines).
The following command, issued at the operating system prompt, sends the output of "myreport" to the specified file and to the default printer, assuming the default value of 61 lines per page. It does not require the .formfeeds statement.
report mydb myreport -frepfile.lis -o
For a format that uses 66 lines per page, you can add the flag ‑v66 at the end of the report command line, or you can use the .pagelength statement in the report specification.
For a printer that is 80 characters wide, you can add the flag ‑l80 or use the .pagewidth statement.
For special forms and other printers, use the .formfeeds statement to instruct Report-Writer to insert its own formfeeds, or the .noformfeeds statement to prevent Report-Writer from inserting them.
You can use the .newpage statement to force an immediate page break at any point in the report. This statement causes Report-Writer to skip enough lines to get to the first line of the page footer (if specified), and to print the page footer before going to the top of the next page.
The .need statement forces a page break to occur if the remaining available lines on the page are less than the number of lines specified in the .need statement. It is used to keep lines of text together on the same page. For instance, this statement can be used prior to a break header to insure that enough lines remain on the current page to print the entire break header.
For details on using variables in reports, see Page Layout and Control Statements in the chapter "Report-Writer Statements."