Layout of an Output Page

This document gives an overview of the statements that may be used to define a specific layout for a report.

The following topics are covered:


Statements Influencing a Report Layout

The following statements have an impact on the layout of the report:

Statement Function
WRITE TITLE With this statement, you can specify a page title, that is, text to be output at the top of a page. By default, page titles are centered and not underlined.
WRITE TRAILER With this statement, you can specify a page trailer, that is, text to be output at the bottom of a page. By default, the trailer lines are centered and not underlined.
AT TOP OF PAGE With this statement, you can specify any processing that is to be performed whenever a new page of the report is started. Any output from this processing will be output below the page title.
AT END OF PAGE With this statement, you can specify any processing that is to be performed whenever an end-of-page condition occurs. Any output from this processing will be output below any page trailer (as specified with the WRITE TRAILER statement).
AT START OF DATA With this statement, you specify processing that is to be performed after the first record has been read in a database processing loop. Any output from this processing will be output before the first field value. See note below.
AT END OF DATA With this statement, you specify processing that is to be performed after all records for a processing loop have been processed. Any output from this processing will be output immediately after the last field value. See note below.
DISPLAY / WRITE With these statements, you control the format in which the field values that have been read are to be output. See section Statements DISPLAY and WRITE.

Note:
The relevance of the statements AT START OF DATA and AT END OF DATA for the output of data is described under Database Access, AT START/END OF DATA Statements. The other statements listed above are discussed in other sections of the part Controlling Data Output.

General Layout Example

The following example program illustrates the general layout of an output page:

** Example 'OUTPUX01': Several sections of output
************************************************************************
DEFINE DATA LOCAL
1 EMP-VIEW VIEW OF EMPLOYEES
  2 NAME
  2 FIRST-NAME
  2 BIRTH
END-DEFINE
*
WRITE TITLE   '********** Page Title **********'
WRITE TRAILER '********** Page Trailer **********'
*
AT TOP OF PAGE
  WRITE '===== Top of Page ====='
END-TOPPAGE
AT END OF PAGE
  WRITE '===== End of Page ====='
END-ENDPAGE
*
READ (10) EMP-VIEW BY NAME
  /*
  DISPLAY NAME FIRST-NAME BIRTH (EM=YYYY-MM-DD)
  /*
  AT START OF DATA
    WRITE '>>>>> Start of Data >>>>>'
  END-START
  AT END OF DATA
    WRITE '<<<<< End of Data <<<<<'
  END-ENDDATA
END-READ
END

Output of Program OUTPUX01:

                    ********** Page Title **********
===== Top of Page =====
        NAME              FIRST-NAME         DATE
                                              OF
                                            BIRTH
-------------------- -------------------- ----------
   
>>>>> Start of Data >>>>>
ABELLAN              KEPA                 1961-04-08
ACHIESON             ROBERT               1963-12-24
ADAM                 SIMONE               1952-01-30
ADKINSON             JEFF                 1951-06-15
ADKINSON             PHYLLIS              1956-09-17
ADKINSON             HAZEL                1954-03-19
ADKINSON             DAVID                1946-10-12
ADKINSON             CHARLIE              1950-03-02
ADKINSON             MARTHA               1970-01-01
ADKINSON             TIMMIE               1970-03-03
<<<<< End of Data <<<<<
                  ********** Page Trailer **********
===== End of Page =====