Creating Headings and Footings

This chapter provides an overview of SQR pages and discusses how to create page headings and footings.

Click to jump to parent topicUnderstanding SQR Pages

Typically, every page of a report has some information about the report itself, such as the title , the date , and the page number. In SQR, the page can be subdivided into three logical areas:

The heading, body, and footing of the page each have independent line numbers. You can print in each of these page areas by using line numbers that are relative to the top corner of that area without being concerned about the size of the other areas. That is, you can print to the first line of the body by using line number 1, independent of the size of the heading.

Note. Any space that is reserved for the heading and footing is taken from the body area of the page. With one line each in the heading and footing, the maximum possible size of the body of the report is reduced by two lines. Note also that line 1 of the body is actually the first line after the heading.

Click to jump to parent topicCreating Page Headings and Footings

This section provides an overview of the heading and footing code example and discusses how to:

Click to jump to top of pageClick to jump to parent topicUnderstanding the Heading and Footing Code Example

Here is an example of the code that is required to add a page heading and footing to a program:

Program ex2a.sqr begin-program print 'Hello, World.' (1,1) end-program begin-heading 1 print 'Tutorial Report' (1) center end-heading begin-footing 1 ! print "Page n of m" in the footing page-number (1,1) 'Page ' last-page () ' of ' end-footing

The output for the ex2a.sqr program is:

Tutorial Report Hello, World. Page 1 of 1

Note. The PRINT command places text in memory, not on paper. SQR for PeopleSoft always prepares a page in memory before printing it to paper, creating the body first, then the HEADING and FOOTING sections. In this example, Hello, World is run first, then Tutorial Report and Page 1 of 1.

Click to jump to top of pageClick to jump to parent topicAdding Page Headings

Define the page heading in the HEADING section. Begin the section with BEGIN-HEADING and end it with END-HEADING. Follow the BEGIN-HEADING command with a number that represents the number of lines that are reserved for the heading. (In this example, the 1 indicates a heading of one line.)

In the heading and footing sample program, the heading uses exactly one line and contains the text Tutorial Report. The CENTER argument ensures that the text is centered on the line.

Click to jump to top of pageClick to jump to parent topicAdding Page Footings

Define the page footing in the FOOTING section. Begin the section with BEGIN-FOOTING, and end it with END-FOOTING. 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, 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.