DECLARE-LAYOUT

Function

Defines the attributes for the layout of an output file.

Syntax

DECLARE-LAYOUT layout_name
[PAPER-SIZE=({paper_width_num_lit[uom],paper_depth_num_lit[uom]}|{paper_name})]
[FORMFEED=form_feed_lit]
[ORIENTATION=orientation_lit]
[LEFT-MARGIN=left_margin_num_lit[uom]]
[TOP-MARGIN=top_margin_num_lit[uom]]
[RIGHT-MARGIN=right_margin_num_lit[uom]
|LINE-WIDTH=line_width_num_lit[uom]
|MAX-COLUMNS=columns_int_lit]
[BOTTOM-MARGIN=bottom_margin_num_lit[uom]
|PAGE-DEPTH=page_depth_num_lit[uom]
|MAX-LINES=lines_int_lit]
[CHAR-WIDTH=char_width_num_lit[uom]]
[LINE-HEIGHT=line_height_num_lit[uom]]
END-DECLARE

Arguments

layout_name

Unique layout name used to reference the layout and its attributes.

uom

Optional suffix which denotes the unit of measure applied to the preceding value.

Table 29. Valid uom Suffixes

Suffix

Meaning

Definition

dp

decipoint

0.001388 inch

pt

point

0.01388 inch

mm

millimeter

0.03937 inch

cm

centimeter

0.3937 inch

in

inch

1.0000 inch

paper_name

An option of PAPER-SIZE. This name is associated with predefined dimensions.

Table 30. Valid Paper Names

Name

Width

Depth

Orientation

Letter

8.5 in

11 in

Portrait

Legal

8.5 in

14 in

Portrait

A4

8.27 in

11.69 in

Portrait

A3

11.69 in

16.54 in

Portrait

Executive

7.25 in

10.5 in

Portrait

B5

7.17 in

10.12 in

Portrait

Com-10

4.125 in

9.5 in

Landscape

Monarch

3.875 in

7.5 in

Landscape

DL

4.33 in

8.66 in

Landscape

C5

6.378 in

9.016 in

Landscape

Table 31. DECLARE-LAYOUT Command Arguments

Argument

Choice or Default uom

Default Value

Description

PAPER‑SIZE

inches

8.5 in, 11 in

Physical size of the page. The first parameter is the width of the page. The second parameter is the depth or length. It may also be a predefined name. (See Table 30.) Note: When ORIENTATION= LANDSCAPE the default values are 11 in, 8.5 in.

FORMFEED

YES, NO

YES

Whether to write form feeds at the end of each page.

ORIENTATION

PORTRAIT, LANDSCAPE

PORTRAIT

Portrait = vertical. Landscape = horizontal. Printing in landscape for the printer type HPLASERJET requires landscape fonts.

LEFT‑MARGIN

inches

0.5 in

Amount of blank space to leave at the left side of the page.

TOP‑MARGIN

inches

0.5 in

Amount of blank space to leave at the top of the page.

RIGHT‑MARGIN

inches

0.5 in

Amount of blank space to leave at the right side of the page. If you specify LINE‑WIDTH or MAX‑COLUMNS, you cannot use this parameter.

LINE-WIDTH

inches

7.5 in

Length of the line. If you specify RIGHT‑MARGIN or MAX-COLUMNS, you cannot use this parameter.

MAX‑COLUMNS

 

75

Maximum number of columns in a line. If you specify RIGHT‑MARGIN or LINE-WIDTH, you cannot use this parameter.

BOTTOM‑MARGIN

inches

0.5 in

Amount of blank space to leave at the bottom of the page. If you specify PAGE‑DEPTH or MAX-LINES, you cannot use this parameter.

PAGE-DEPTH

inches

10 in

Depth of the page. If you specify BOTTOM-MARGIN or MAX-LINES, you cannot use this parameter.

MAX‑LINES

 

60

Maximum number of lines printed on the page. If you specify PAGE‑DEPTH or BOTTOM-MARGIN, you cannot use this parameter.

LINE-HEIGHT

points

12 pt

Size of each line on the page. There are 72 points per inch. If LINE-HEIGHT is not specified, it follows the value for POINT-SIZE, if specified. The default value of 12 points yields 6 lines per inch. For the printer type LINEPRINTER, this value is used only to calculate the TOP‑MARGIN and BOTTOM‑MARGIN (for example, not in computing the position on the page).

CHAR-WIDTH

points

7.2 pt

Size of each horizontal character column on the page (for example, the distance between the locations (1, 12) and (1, 13)). For the printer type LINEPRINTER, this value is used only to calculate the TOP‑MARGIN and BOTTOM‑MARGIN (not in computing the position on the page).

Description

DECLARE-LAYOUT describes the characteristics of a layout to use for an output file. A layout can be shared by more than one report. You can define as many layouts as are necessary for the requirements of the application. You can override the default layout attributes by defining a layout called DEFAULT in your program. Each layout name must be unique.

Production Reporting maps its line and column positions on the page by using a grid determined by the LINE‑HEIGHT and CHAR‑WIDTH arguments. That is, Production Reporting calculates the number of columns per row by dividing the LINE-WIDTH by the CHAR‑WIDTH and calculates the number of lines by dividing the PAGE-DEPTH by the LINE‑HEIGHT. Each printed segment of text is placed on the page using this grid. Because the characters in proportional fonts vary in width, it is possible that a word or string is wider than the horizontal space you have allotted, especially in words containing uppercase letters or bold characters. To account for this behavior, you can either move the column position in the PRINT or POSITION statements or indicate a larger CHAR-WIDTH in DECLARE‑LAYOUT.

The ORIENTATION parameter selects the proper fonts. In addition, the parameter interacts with PAPER-SIZE as follows:

DECLARE-REPORT (Setup)

DECLARE-LAYOUT (Setup)

DECLARE-PRINTER(Setup)

DECLARE-PROCEDURE (Setup)

DECLARE-TOC (Setup)

USE-REPORT (Body)

USE-PROCEDURE (Body)

USE-PRINTER-TYPE (Body)

TOC-ENTRY (Body)

ALTER-PRINTER (Body)

BEGIN-HEADING For-Tocs=( ) (Construct)

BEGIN-FOOTING For-Tocs=( ) (Construct)

BEGIN-HEADING For-Reports=( ) (Construct)

BEGIN-FOOTING For-Reports=( ) (Construct)

Examples

The following example illustrates the ability to specify parameters using a metrics measurement system. (The syntax results in a paper size of 210mm by 297mm, a top margin of 12.7mm, a left margin of 12.7mm, a right margin of 25.4mma bottom margin of 12.7mm, a portrait orientation, 67 columns, and 63 lines.

declare-layout my-layout
  paper-size=(a4)         
  left-margin=12.7 mm     
  right-margin=25.4 mm 
end-declare         

The following example changes the page dimensions. It also changes the left and right margins to one inch. (The syntax results in a paper size of 14 inches by 11 inches, a top margin of 0.5 inches, a left margin of one inch, a right margin of one inch, a bottom margin of 0.5 inches, a portrait orientation, 120 columns, and 60 lines.)

declare-layout large-paper
  paper-size=(14, 11)
  left-margin=1        
  right-margin=1      
end-declare          

The following example retains the default page dimensions and changes the left and right margins to one inch. (The syntax results in a paper size of 8.5 inches by 11 inches, a top margin of 0.5 inches, a left margin of one inch, a right margin of one inch, a bottom margin of 0.5 inches, a portrait orientation, 65 columns, and 60 lines.)

declare-layout default
  left-margin=1        
  right-margin=1        
end-declare      

The following example changes the orientation to landscape. The columns and rows are recalculated. All other values remain the same. (The syntax results in a paper size of 11 inches by 8.5 inches, a top margin of 0.5 inches, a left margin of 0.5 inches, a right margin of 0.5 inches, a bottom margin of 0.5 inches, 100 columns and 45 lines.)

declare-layout default   
  orientation=landscape   
end-declare    

The following example changes the orientation to landscape. In addition the top margin is set to one inch. (The syntax results in a paper size of 11 inches by 8.5 inches, a top margin of 0.5 inches, a left margin of 0.5 inches, a right margin of 0.5 inches, a bottom margin of 0.5 inches, a landscape orientation, 100 columns and 43 lines.)

declare-layout my_landscape
  orientation=landscape
  top-margin=1 
end-declare

The following example specifies the page dimensions using a predefined name. Note that the orientation changes since this example is an envelope.(The syntax results in a paper size of 4.125 inches by 9.5 inches,. a top margin of 0.5 inches, a left margin of 0.5 inches, a right margin of 0.5 inches, a bottom margin of 0.5 inches, a landscape orientation, 85 columns and 18 lines.)

declare-layout envelope
  paper-size=(com-10)
end-declare

See Also

DECLARE-REPORT