The PRINT HEADING statement creates report page headings. A PRINT or PRINT TOTAL statement must accompany a PRINT HEADING statement. A PRINT HEADING statement must occur in the same processing step as its associated PRINT or PRINT TOTAL statement.

PRINT HEADING statements are in effect for only one processing step. A PRINT HEADING statement has no effect if it is not in the same processing step as a PRINT or PRINT TOTAL statement.

Column headings are derived from the default headings in the data definition tables. The default column headings override any column headings you define in the PRINT HEADING statement, but you can use PRINT HEADING lines 2 and 3 to add extra information to the column headings (see Example 2 below). To change the default column headings, use the DEFINE statement.

The syntax is as follows:

PRINT HEADING "Parms".

Parms:

[lineid]
[AT [NEW-PAGE | END-JOB]]
[fieldname | literal] ...
  • lineid
    Specifies the heading line defined by this statement. The default is 1. Heading lines 0 and 1 are report heading lines. Heading lines 2 and 3 are column heading lines. Values defined for lines 2 and 3 are shared by the field headings from the data definition tables or those set by the DEFINE statement.
  • NEW-PAGE
    Specifies that the heading is printed on the top of each report page.
  • END-JOB
    Specifies that the heading is printed only on the last page of the report. This forces final totals onto a separate page. For more information, see the section PRINT TOTAL Statement.
  • fieldname
    Specifies that an alphanumeric field name is printed in a column heading, lines 2 and 3.
  • literal
    Specifies that a literal string is printed in a report heading. A single literal cannot span two PRINT statements. The literal string must be enclosed in quotes.

Examples

  • This PRINT HEADING statement defines the report heading DATA SET SUMMARY, and uses blanks to center the heading:

    PRINT HEADING 1 ' DATA SET SUMMARY '.
    
  • This PRINT HEADING statement creates a new column heading that appears beside the default heading taken from the data definition table:

    PRINT HEADING 3 ' ' 'AT DATE 02/10/10'.
    PRINT USERID.

    These statements produce:

    USERID AT DATE 02/10/10
    TINKER
    EVERS
    CHANCE