TITLE in COBOL is generally a concept or vendor feature used to display headings and labels in reports and terminal screens. Standard COBOL provides mechanisms (REPORT SECTION, SCREEN SECTION, and DISPLAY) to implement titles consistently.
Implement titles using REPORT SECTION headings, SCREEN SECTION literals, or explicit DISPLAY at specific positions.
1234567891011121314* Report title using Report Writer IDENTIFICATION DIVISION. PROGRAM-ID. REPORT-TITLE. REPORT SECTION. RD SALES-REPORT. 01 PAGE-HEADING. 03 LINE 1 COLUMN 20 VALUE "=== MONTHLY SALES REPORT ===". 03 LINE 2 COLUMN 25 VALUE "For: ". 03 LINE 2 COLUMN 31 PIC X(10) SOURCE REPORT-MONTH. 01 DETAIL. 03 LINE PLUS 2 COLUMN 5 VALUE "Customer". 03 COLUMN 30 VALUE "Amount". PROCEDURE DIVISION. STOP RUN.
Headings serve as the report title. Exact syntax may vary by compiler.
1234567891011121314* Screen title centered in 80 columns IDENTIFICATION DIVISION. PROGRAM-ID. SCREEN-TITLE. DATA DIVISION. WORKING-STORAGE SECTION. 01 TITLE-TEXT PIC X(30) VALUE "Customer Maintenance". 01 TITLE-LEN PIC 9(3). 01 LINE-WIDTH PIC 9(3) VALUE 80. 01 START-COL PIC 9(3). PROCEDURE DIVISION. COMPUTE TITLE-LEN = FUNCTION LENGTH(TITLE-TEXT) COMPUTE START-COL = (LINE-WIDTH - TITLE-LEN) / 2 DISPLAY TITLE-TEXT AT LINE 1 COLUMN START-COL STOP RUN.
Use arithmetic to center titles on fixed-width terminals.
Context | Technique | Example |
---|---|---|
Report | REPORT SECTION heading | PAGE-HEADING with VALUE text |
Screen | DISPLAY or SCREEN SECTION literal | DISPLAY at line 1, centered |
Batch print | Top-of-page banner | Constructed from literals and dates |
1. What does TITLE most commonly refer to in COBOL contexts?
2. Which section is most associated with report titles in COBOL?
3. How are screen titles typically implemented in COBOL?
4. Is TITLE a standard COBOL reserved word with universal behavior?
5. What is a best practice for implementing titles?