Home » COBOL Program Structure

COBOL Program Structure

by Online Tutorials Library

COBOL – Program Structure

Before defining the program structure of COBOL, you must know the syntax of a COBOL program.

COBOL Syntax

COBOL is a high-level language that follows English-like syntax, used to describe everything in a program.

For example: In a COBOL program, a condition can be expressed as x IS GREATER THAN y or more concisely as x GREATER y or x > y. It also abbreviates the complex conditions by removing the repeated conditions and variables. For example, a > b AND a > c OR a = d can be shortened to a > b AND c OR = d. To support this English-like syntax, COBOL uses more than 300 keywords.

COBOL Program Structure

COBOL uses its compiler to translate the program into an object program before the execution. To execute the COBOL program without an error, we must put the divisions in proper order.

The COBOL program contains a logical structure called structure COBOL programming. It follows an organized way to do the programming. You must follow a modular programming approach, which is a subset of the procedural programming approach to do this.

The COBOL program follows a hierarchical structure that is made of different components like division, section, paragraph, sentence, and characters.

All components don’t need to be present for the hierarchical relationship to exist. The division is the topmost of the component and may contain one or more sections. Similarly, a section may contain one or more paragraphs. A paragraph may contain one or more sentences, and so on.

See the following image to understand the hierarchical structure of the COBOL program:

COBOL Program Structure

Let’s see the short description of these components:

Division

This is the topmost component of the COBOL program and the most important one. It is a collection of sections, paragraphs, sentences, or a block of characters. This generally contains one or more sections which are later divided into paragraphs. The starting line of a division is the division name, and the end line of division is the beginning of the next division or the end of the program. Divisions are System-defined words, and all divisions should be in Area A.

A COBOL program can be split into the following four divisions:

  • Identification division
  • Environment division
  • Data division
  • Procedure division

Section

Sections are the logical subdivision of the program logic. A section is a collection of paragraphs in the hierarchical structure of the COBOL program. It may contain one or more paragraphs.

Paragraph

A paragraph is a subpart of a section that is already a subpart of a division in the hierarchical structure of the COBOL program. It is a user-defined or predefined name followed by a period. It may contain one or more sentences.

Sentence

Sentences are the combination of one or more statements. A sentence may contain one or more statements. Sentences appear only in the Procedure division. A sentence must end with a period.

Statements

Statements are something like commands that are used to perform some processing of the COBOL program. These COBOL statements can be divided into different categories and are further subdivided into different variants. A statement may contain one or more characters.

Character

Characters are the most basic and indivisible unit of the COBOL language. It includes the Latin alphabet letters, digits, and special characters. These are the lowest components in the COBOL program hierarchy, and they can’t be divided anymore.


Next TopicCOBOL Coding Sheet

You may also like