Structural Hierarchy

132 Views


Structural Hierarchy 

All COBOL programs are organized in a structure that consists of divisions, sections, paragraphs, sentences, statements, clauses, and phrases.  

This structure is hierarchical--that is, as a general rule,

  • a COBOL program is made up of divisions;
  • a division is made up of sections;
  • a section is made up of paragraphs;
  • a paragraph is made up of either sentences or clauses (depending upon the division); a sentence can contain one or more statements;
  • a statement or clause can contain one or more phrases.

The general hierarchy appears schematically in Figure.

Those COBOL constructs with English language counterparts (paragraphs, sentences, clauses, and phrases) generally resemble their corresponding counterparts.  

From the standpoint of the compiler, each construct is treated as a logical entity within your program.

COBOL Structure Hierarchy 

Below Figure is an example of the COBOL program structure.  The numbers indicate specific parts of the program.

The items shown in Figure 2-2  are:

   1.  Identification Division.
   2.  Environment Division.
   3.  Data Division.
   4.  Procedure Division.
   5.  Working-Storage Section.
   6.  Program-Id Paragraph.
   7.  Author Paragraph.
   8.  A paragraph in the Procedure Division.
   9.  A user-defined paragraph name.
  10.  A sentence in the Procedure Division.
  11.  The program name.
  12.  The author's name.

  

Post Comments