Adding Declarations Using the SETUP Section

This chapter provides an overview of the SETUP section and discusses how to:

Click to jump to parent topicUnderstanding the SETUP Section

The SETUP section of the program is where you place all of the declarations. Declarations define certain report characteristics and the source and attributes of various report components, such as charts and images. The SETUP section is evaluated when you compile the program, before you run the program. A program doesn't have to have a SETUP section, but it can be useful.

Click to jump to parent topicCreating the SETUP Section

Place the SETUP section, if present, at the beginning of the program before the PROGRAM section. Begin with BEGIN-SETUP and end with END-SETUP.

Use the following commands in the SETUP section:

Command

Comments

ALTER-LOCALE

Can also appear in a procedure.

ASK

Allowed only in a SETUP section.

BEGIN-SQL

Can also appear in a procedure. Processed when a runtime file (with .SQT extension) is loaded.

CREATE-ARRAY

Can also appear in a procedure.

DECLARE-CHART

NA

DECLARE-IMAGE

NA

DECLARE-LAYOUT

NA

DECLARE-PRINTER

NA

DECLARE-PROCEDURE

NA

DECLARE-REPORT

NA

DECLARE-TOC

NA

DECLARE-VARIABLE

Can also appear in a local procedure.

LOAD-LOOKUP

Can also appear in a procedure.

USE

Sybase only.

See Also

Enterprise PeopleTools 8.50 PeopleBook: SQR Language Reference for PeopleSoft

Click to jump to parent topicUsing the DECLARE-LAYOUT Command

Use the DECLARE-LAYOUT command to set the page layout and include important options, such as the paper size and margins.

Click to jump to top of pageClick to jump to parent topicSample SETUP Program

Here is a typical SETUP section:

begin-setup ! Declare the default layout for this report declare-layout default paper-size=(8.5,11) left-margin=1 right-margin=1 top-margin=1 bottom-margin=1 end-declare end-setup

In the preceding example, the DECLARE-LAYOUT command sets the paper size to 8 1/2 by 11 inches, with all margins at 1 inch.

In SQR for PeopleSoft, data is positioned on the page using line and character position coordinates. Think of the page as a grid where each cell holds one character. With such a grid, in a position qualifier consisting of (line, column, width), column and width are numbers that denote characters and spaces.

Click to jump to top of pageClick to jump to parent topicDefining the SQR Page Layout

The main attributes of the DECLARE-LAYOUT command affect the structure of the page.

The PAPER-SIZE argument defines the dimensions of the entire page, including the margins. The TOP-MARGIN, LEFT-MARGIN, BOTTOM-MARGIN, and RIGHT-MARGIN arguments define the margins. In SQR, you cannot print in the margins.

In the preceding sample program, the left margin uses 10 spaces and the top margin uses 6 lines. The page width accommodates 65 characters (without the margins) and 54 lines.

The default mapping of characters and lines to inches is 10 characters per inch (CPI) and six lines per inch (LPI). This means that each character cell is 1/10 inch wide and 1/6 inch high. These settings are used when a program does not contain a DECLARE-LAYOUT command.

Click to jump to parent topicOverriding the Default Settings

Override the default settings by using the LINE-HEIGHT and CHAR-WIDTH arguments in the DECLARE-LAYOUT command. These arguments adjust the dimensions of the grid, which implies a change in the meaning of column and line. If the DECLARE-LAYOUT paragraph includes the LINE-HEIGHT=1 and CHAR-WIDTH=1 arguments, the cells in the grid measure one point by one point (one point is 1/72 inch or approximately 0.35 millimeters). In that case, column is a dimension given in points. The length of a string, however, is still given in characters.

Alternatively, you can use the MAX-LINES and MAX-COLUMNS arguments of the DECLARE-LAYOUT command to specify the number of lines on the page and the number of characters to fit across the page. SQR calculates the line height and character width based on these settings and the size of the page and margins.

Specify coordinates in terms of lines and character positions. The first line from the top is 1 and the first column (from the left) is 1. No coordinate 0 exists.

Click to jump to parent topicDeclaring the Page Orientation

Use the DECLARE-LAYOUT command to declare the page orientation. Note that this declaration does not affect how SQR uses position coordinates. Line and character positions are not transposed when page orientation is switched. The only effect of the ORIENTATION option of the DECLARE-LAYOUT command is that SQR switches the printer to the specified orientation: portrait or landscape. The default mode is portrait.