PAGE Statement

The PAGE statement causes the current page to be ended and the footing to print at the bottom of the page.

Format

PAGE[expr]

Parameter(s)

expr

An expression evaluating to the page number to appear on the next page.

Description

The PAGE statement ends the current page of output by sending the footing to the bottom of the page and waiting for a carriage return to continue output. The N option to the HEADING statement suppresses waiting for the carriage return.

If a page number is specified, the next page of output is numbered with the new page number expr. Each subsequent page number increments by one. Note that the current page number is numbered expr-1, which appears in the current page footing if a page number is included in the footing specifications. The page heading is not affected until the next page of output.

The HEADING statement is necessary to initialize the page parameters for a program. The PAGE statement has no effect if the HEADING statement is not used in a program. See HEADING Statement for more information.

The HEADING, FOOTING, and PAGE statements affect the same output device that the PRINT statement does. The PRINTER statement toggles the output device between the terminal screen and the printer.

If multiple print files are used, the HEADING, FOOTING, and PAGE statements only affects print file 0 (the default).

Example

In this application, the contents of each item in a file are printed with the internal subroutine PRINTOUT. The PAGE statement is used before PRINTOUT is called to ensure that each report starts on page 1.

LOOP

   READNEXT ITEM ELSE

      END.OF.LIST = 1

   END

UNTIL END.OF.LIST DO

   MATREAD REPORT FROM LOGFILE,ITEM ELSE ...

   PAGE 1

   GOSUB PRINTOUT

   PRINTER CLOSE

REPEAT

See Also

Statement and Function Reference