MainframeMaster

COBOL Tutorial

COBOL TITLE - Quick Reference

Progress0 of 0 lessons

Overview

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.

Where TITLE Appears

  • Report titles - Page/report headings in REPORT SECTION
  • Screen headers - Literal fields or DISPLAY statements
  • Print headings - Top-of-page banners in batch reports
  • Dialogue prompts - Descriptive headings for user tasks

Syntax and Usage

Implement titles using REPORT SECTION headings, SCREEN SECTION literals, or explicit DISPLAY at specific positions.

Report Title (Report Writer)

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
* 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.

Screen Title (DISPLAY or SCREEN SECTION)

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
* 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.

Best Practices

  • Consistency - Use consistent title formatting across screens and reports
  • Clarity - Keep titles concise and descriptive
  • Localization - Externalize text for translation when needed
  • Accessibility - Ensure adequate contrast and placement

TITLE Quick Reference

ContextTechniqueExample
ReportREPORT SECTION headingPAGE-HEADING with VALUE text
ScreenDISPLAY or SCREEN SECTION literalDISPLAY at line 1, centered
Batch printTop-of-page bannerConstructed from literals and dates

Test Your Knowledge

1. What does TITLE most commonly refer to in COBOL contexts?

  • A standalone COBOL verb for printing text
  • A concept/attribute used for report headings and screen headers
  • A file organization method
  • A numeric editing symbol

2. Which section is most associated with report titles in COBOL?

  • REPORT SECTION (Report Writer)
  • ENVIRONMENT DIVISION
  • FILE SECTION
  • LINKAGE SECTION

3. How are screen titles typically implemented in COBOL?

  • By setting a TITLE keyword in the IDENTIFICATION DIVISION
  • By placing a DISPLAY at a fixed position or using SCREEN SECTION text
  • By using a special TITLE file
  • By using a PERFORM TITLE statement

4. Is TITLE a standard COBOL reserved word with universal behavior?

  • Yes, across all COBOL compilers
  • No, behavior and availability can be vendor-specific
  • It only exists in JCL
  • It is deprecated and cannot be used

5. What is a best practice for implementing titles?

  • Hard-code positions without documentation
  • Use consistent formatting, center when needed, and keep text concise
  • Avoid using titles in interactive programs
  • Use binary fields for titles

Frequently Asked Questions