TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

COBOL - Program Format

COBOL programs must be written in the COBOL reference format. The below diagram illustrates the reference format for a COBOL source line.

image missing

The following areas are described below in terms of a 72-character line:

Columns 1 through 6 : Sequence Number Area

The sequence number area may be used to label a source statement line. The content of this area may consist of any character in the character set of the computer.

Column 7 : Indicator Area (comments and continuation)
  • Any sentence, entry, clause, or phrase that requires more than one line can be continued in Area B of the next line which is not a
    • Comment line
    • Blank line

  • Area A of a continuation line must be blank.

  • If no hyphen (-) in indicator Area.

  • Last character of the preceding line is assumed to be followed by a space.

  • If hyphen is in Indicator Area: First non-blank character of this continuation line immediately follows the last non-blank char of continues line.

  • If the continued line contains a non-numeric literal without a closing quotation mark:
    • All spaces at the end of the continued line (through column 72) are part of the litral.
    • Continuation line must contain a hyphen in the indicator area.
    • First non-blank character must be a quotation mark and Literal.
    • Continues with the character following the quotation mark.
Columns 8 through 11 : Area A

The following items must begin in Area A:
  • Division header
  • Section header
  • Paragraph header or paragraph name
  • Level indicator or level-number (01 and 77)
  • End program header.
Area B: Columns 12 through 72:
  • Entries, sentences, statements, clauses
  • Continuation lines.
Program Identification: Columns 73 through 80
  • This area was originally designed for entering the program identification on each individual line of code
  • Once cards were replaced with disk drives, this area fell into disuse.
Mainframe screen : See left side top- COLS(this represent the column number)

image missing

Video Tutorial: COBOL Progam Structure

We will see in detail about each area and it's statements in upcoming chapters.

If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal