Column Headers

This document describes various ways of controlling the display of column headers produced by a DISPLAY statement.

The following topics are covered:


Default Column Headers

By default, each database field output with a DISPLAY statement is displayed with a default column header (which is defined for the field in the DDM).

** Example 'DISPLX01': DISPLAY
************************************************************************
DEFINE DATA LOCAL
1 VIEWEMP VIEW OF EMPLOYEES
  2 PERSONNEL-ID
  2 NAME
  2 BIRTH
  2 JOB-TITLE
END-DEFINE
*
READ (3) VIEWEMP BY BIRTH
  DISPLAY PERSONNEL-ID NAME JOB-TITLE
END-READ
END

Output of Program DISPLX01:

The above example program uses default headers and produces the following output.

Page      1                                                  04-11-11  14:15:54
 
PERSONNEL         NAME                  CURRENT
   ID                                  POSITION
--------- -------------------- -------------------------
 
30020013  GARRET               TYPIST
30016112  TAILOR               WAREHOUSEMAN
20017600  PIETSCH              SECRETARY

Suppress Default Column Headers - NOHDR Option

If you wish your report to be output without column headers, add the keyword NOHDR to the DISPLAY statement.

DISPLAY NOHDR PERSONNEL-ID NAME JOB-TITLE

Define Your Own Column Headers

If you wish column headers of your own to be output instead of the default headers, you specify 'text' (in apostrophes) immediately before a field, text being the header to be used for the field.

** Example 'DISPLX08': DISPLAY  (with column title in 'text')
************************************************************************
DEFINE DATA LOCAL
1 VIEWEMP VIEW OF EMPLOYEES
  2 PERSONNEL-ID
  2 NAME
  2 BIRTH
  2 JOB-TITLE
END-DEFINE
*
READ (3) VIEWEMP BY BIRTH
  DISPLAY PERSONNEL-ID
         'EMPLOYEE' NAME
         'POSITION' JOB-TITLE
END-READ
END

Output of Program DISPLX08:

The above program contains the header EMPLOYEE for the field NAME, and the header POSITION for the field JOB-TITLE; for the field PERSONNEL-ID, the default header is used. The program produces the following output:

Page      1                                                  04-11-11  14:15:54
 
PERSONNEL       EMPLOYEE               POSITION
   ID
--------- -------------------- -------------------------
 
30020013  GARRET               TYPIST
30016112  TAILOR               WAREHOUSEMAN
20017600  PIETSCH              SECRETARY

Combining NOTITLE and NOHDR

To create a report that has neither page title nor column headers, you specify the NOTITLE and NOHDR options together in the following order:

DISPLAY NOTITLE NOHDR PERSONNEL-ID NAME JOB-TITLE

Centering of Column Headers - HC Parameter

By default, column headers are centered above the columns. With the HC parameter, you can influence the placement of column headers.

If you specify

HC=L headers will be left-justified.
HC=R headers will be right-justified.
HC=C headers will be centered.

The HC parameter can be used in a FORMAT statement to apply to the whole report, or it can be used in a DISPLAY statement at both statement level and element level, for example:

DISPLAY (HC=L) PERSONNEL-ID NAME JOB-TITLE

Width of Column Headers - HW Parameter

With the HW parameter, you determine the width of a column output with a DISPLAY statement.

If you specify

HW=ON the width of a DISPLAY column is determined by either the length of the header text or the length of the field, whichever is longer. This also applies by default.
HW=OFF the width of a DISPLAY column is determined only by the length of the field. However, HW=OFF only applies to DISPLAY statements which do not create headers; that is, either a first DISPLAY statement with NOHDR option or a subsequent DISPLAY statement.

The HW parameter can be used in a FORMAT statement to apply to the entire report, or it can be used in a DISPLAY statement at both statement level and element (field) level.

Filler Characters for Headers - Parameters FC and GC

With the FC parameter, you specify the filler character which will appear on either side of a header produced by a DISPLAY statement across the full column width if the column width is determined by the field length and not by the header (see HW parameter above); otherwise FC will be ignored.

When a group of fields or a periodic group is output via a DISPLAY statement, a group header is displayed across all field columns that belong to that group above the headers for the individual fields within the group. With the GC parameter, you can specify the filler character which will appear on either side of such a group header.

While the FC parameter applies to the headers of individual fields, the GC parameter applies to the headers for groups of fields.

The parameters FC and GC can be specified in a FORMAT statement to apply to the whole report, or they can be specified in a DISPLAY statement at both statement level and element (field) level.

** Example 'FORMAX01': FORMAT (with parameters FC, GC)
************************************************************************
DEFINE DATA LOCAL
1 VIEWEMP VIEW OF EMPLOYEES
  2 NAME
  2 INCOME (1:1)
    3 CURR-CODE
    3 SALARY
    3 BONUS (1:1)
END-DEFINE
*
FORMAT FC=* GC=$
*
READ (3) VIEWEMP BY NAME
  DISPLAY NAME (FC==) INCOME (1)
END-READ
END

Output of Program FORMAX01:

Page      1                                                  04-11-11  14:15:54
                                                                               
========NAME======== $$$$$$$$$$$$INCOME$$$$$$$$$$$$                            
                                                                               
                     CURRENCY **ANNUAL** **BONUS***                            
                         CODE     SALARY                                       
-------------------- -------- ---------- ----------                            
                                                                               
ABELLAN              PTA         1450000          0                            
ACHIESON             UKL           10500          0                            
ADAM                 FRA          159980      23000

Underlining Character for Titles and Headers - UC Parameter

By default, titles and headers are underlined with a hyphen (-).

With the UC parameter, you can specify another character to be used as underlining character.

The UC parameter can be specified in a FORMAT statement to apply to the whole report, or it can be specified in a DISPLAY statement at both statement level and element (field) level.

** Example 'FORMAX02': FORMAT (with parameter UC)
************************************************************************
DEFINE DATA LOCAL
1 VIEWEMP VIEW OF EMPLOYEES
  2 PERSONNEL-ID
  2 NAME
  2 BIRTH
  2 JOB-TITLE
END-DEFINE
*
FORMAT UC==
*
WRITE TITLE LEFT JUSTIFIED UNDERLINED 'EMPLOYEES REPORT' 
SKIP 1 
READ (3) VIEWEMP BY BIRTH
  DISPLAY PERSONNEL-ID (UC=*) NAME JOB-TITLE
END-READ
END

In the above program, the UC parameter is specified at program level and at element (field) level: the underlining character specified with the FORMAT statement (=) applies for the whole report - except for the field PERSONNEL-ID, for which a different underlining character (*) is specified.

Output of Program FORMAX02:

EMPLOYEES REPORT 
===============================================================================
 
PERSONNEL         NAME                  CURRENT
   ID                                  POSITION
********* ==================== =========================

30020013  GARRET               TYPIST
30016112  TAILOR               WAREHOUSEMAN
20017600  PIETSCH              SECRETARY

Suppressing Column Headers - Slash Notation

With the notation apostrophe-slash-apostrophe ('/'), you can suppress default column headers for individual fields displayed with a DISPLAY statement. While the NOHDR option suppresses the headers of all columns, the notation '/' can be used to suppress the header for an individual column.

The apostrophe-slash-apostrophe ('/') notation is specified in the DISPLAY statement immediately before the name of the field for which the column header is to be suppressed.

Compare the following two examples:

Example 1:

DISPLAY NAME PERSONNEL-ID JOB-TITLE

In this case, the default column headers of all three fields will be displayed:

Page      1                                                  04-11-11  14:15:54
                                                                               
        NAME         PERSONNEL          CURRENT                                
                          ID             POSITION                          
-------------------- --------- -------------------------                 
                                                                               
ABELLAN              60008339  MAQUINISTA               
ACHIESON             30000231  DATA BASE ADMINISTRATOR                   
ADAM                 50005800  CHEF DE SERVICE                           
ADKINSON             20008800  PROGRAMMER                                
ADKINSON             20009800  DBA                                       
ADKINSON             20011000  SALES PERSON          

Example 2:

DISPLAY '/' NAME PERSONNEL-ID JOB-TITLE

In this case, the notation '/' causes the column header for the field NAME to be suppressed:

Page      1                                                  04-11-11  14:15:54
                                                                               
                     PERSONNEL          CURRENT                          
                        ID             POSITION                          
                     --------- -------------------------                 
                                                                               
ABELLAN              60008339  MAQUINISTA                                
ACHIESON             30000231  DATA BASE ADMINISTRATOR                   
ADAM                 50005800  CHEF DE SERVICE                           
ADKINSON             20008800  PROGRAMMER                                
ADKINSON             20009800  DBA                                       
ADKINSON             20011000  SALES PERSON     

Further Examples of Column Headers

See the following example programs: