HEADING Statement

The HEADING statement specifies the text to be printed at the top of each page of output. It is also necessary for initializing page parameters for an output device.

Format

HEADING expr

Parameter(s)

expr

An expression evaluating to the text to be printed as the heading. The special option characters listed below may be included in expr, enclosed in quotes. Multiple options may be specified within a single set of quotes.

P

Current page number.

L

Carriage return and line feed.

T

Current time and date.

D

Current date.

N

Do not wait for carriage return at end of page.

C

Center the line.

Description

Multiple HEADING statements may be used to change the heading within a single program. The first HEADING statement initializes the page parameters for the program; each subsequent HEADING statement does not take effect until the next page of output. Pagination begins with page 1 and increments automatically on generation of each new page.

A HEADING statement is necessary to initialize the page parameters in a program. Without a HEADING statement in the program, FOOTING and PAGE statements have no effect. If the output device is the screen, initializing the page parameters also enables the feature that output is suspended at the end of each page until a carriage return is input. This feature may be disabled by the N option to the HEADING statement. Unlike the other options to HEADING, the N option takes effect on the current page of output. The N option is usually used when output is not going to the terminal but is being routed through the auxiliary port to the printer.

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 units are used, the HEADING, FOOTING, and PAGE statements affect only print unit 0 (the default).

Example

In this application the HEADING statement sets up a heading on each page with "Status Report" in the left corner and the page number on the right. The SPACE function is used to generate the correct number of spaces in the heading.

HEADING "Status Report":SPACE(57):"Page 'PC'"

See Also

Statement and Function Reference