Adding Page Footings

Define the page footing in the FOOTING section. Begin the section with a BEGIN-FOOTING command and end it with an END-FOOTING command. Follow the BEGIN-FOOTING command with a number that represents the number of lines that are reserved for the footing. (In this example, the 1 indicates a footing of one line.) This line consists of the text Page 1 of 1.

Adding Comments

Precede comments with an exclamation mark. The comment extends from the exclamation mark to the end of the line.

In the heading and footing sample program, the first line in the FOOTING section is a comment.

To print an exclamation mark , enter it twice to indicate that it is not the beginning of a comment. For example:

print 'Hello, World!!' (1,1)

Adding Page Numbers

Use the PAGE-NUMBER command to print the text Page and the current page number. Use the LAST-PAGE command to print the number of the last page, preceded by the word of, which is bracketed by spaces.

In the headings and footings code example, Page 1 of 1 appears because only one page exists.

Indicating the Print Position

Include numbers in parentheses following the PRINT, PAGE-NUMBER, and LAST-PAGE commands to indicate the position for printing. Express a position in SQR language with three numbers in parentheses: line number, column number (character position), and width of the text.

In many cases, a position contains only the line and column numbers. The width is normally omitted because it is set by default to the width of the text that is being printed. If you also omit the line and column numbers, then the print position is set by default to the current position, which is the position following the last printed item.

In the heading and footing sample program, the LAST-PAGE command has the position (), so the current position is the position following the page number.

The print position is a point within the area of the page or, more precisely, within the heading, body, or footing. The position (1,1) in the heading is not the same as the position (1,1) in the body. Line 1 of the body is the first line following the heading. In the program, the heading has only one line, so line 1 of the body is actually the second line of the page. Similarly, line 1 of the footing is at the bottom of the page. It is the first line following the body.