Controlling Page Formatting

Parameters on the PAGEDEF and PAGEFORMAT commands let you specify the margins of the page. The TOPMARGIN and BOTMARGIN keywords are used to reserve space at the top and bottom of the page. The page headers and trailers are normally placed into this reserved space.

Note: No other text or objects should be written into the margins - only page header and trailer data.

The bottom margin is also used for two other purposes:

  • a BODY or GRPHEADER Data Record that would cause the baseline position to move into the bottom margin area causes a logical page eject
  • any graphic that has been started with the DRAWGRAPHIC command, but not explicitly ended, automatically ends at print time before it extends into the bottom margin area.

You can force a new logical page in the output with the NEWPAGE keyword on a LAYOUT command (see LAYOUT Command (Record Format)). When an input record is encountered whose Record ID matches that LAYOUT name, a page eject is completed before the record data is processed. If this is a header or trailer layout, the page eject is performed before the header or trailer becomes active.

The ENDSPACE keyword can also be used to control where page ejects are performed. If ENDSPACE is coded on a LAYOUT, and a Data Record with the matching Record ID is encountered, a page eject is performed before the data is processed - if the remaining space on the page (before the bottom margin) is less than the ENDSPACE value.

The ENDSPACE keyword can be used to ensure that a Table Heading (Group Heading) does not print at the end of a page without allowing space for additional Data Records (body records), or to ensure that a table entry does not print at the bottom of a page without allowing space for a totals record.

The following example shows the use of page margins and the NEWPAGE and ENDSPACE keywords:

Sample Page Formatting

PAGEFORMAT  chub1   TOPMARGIN 2 in BOTMARGIN  2 in; 
/************************************************/
/** statmid  BODY                              **/
/************************************************/
LAYOUT C'statmid' PAGEHEADER NEWPAGE ENDSPACE .5 in 
    POSITION .6 in ABSOLUTE .55 in;
    FIELD TEXT C'Big Brother Bank' ALIGN LEFT
    FONT comp ; /* default to LAYOUT positioning */