Structure of COBOL Program



Structure of COBOL Program


The Structure of the Cobol applies for COBOL Source Program which has set of syntactically correct set of statements.

In other words, COBOL Source Program contains set of syntactically correct set of statements.

Cobol Programs contains hierarchical in structure which was shown in the above diagram.

The COBOL Program hierarchy consists of Divisions, Sections, Paragraphs, Sentences and Statements.

In other words, Each division may contain one or more sections, Each section may contain one or more paragraphs,
Each paragraph contains one or more sentences and each section contains one or more statements.

Each element of the hierarchy consists of one or more subordinate elements.

DivisionsSectionsParagraphsSentencesStatements.

Discuss them in reverse order for better understanding

Statements:

It consists of a COBOL verb and an operand or operands describes about COBOL verb process on the operands either
it may be a conditional or unconditional.

A statement should have COBOL verb with an operand and may or may not marked with period at the end.

All statements should be code in the AREA B and should not in AREA A.

There are four categories of statements in COBOL.

1. Imperative

2. Conditional

3. Delimited Scope

4. Compiler directing

Example: ADD A TO B GIVING C.

Sentences:

As stated above, a sentence contains one or more statements and those are marked with a period at the last line.

If those are marked with a period in middle, then it will be treated as statement and those are not considered
as sentence.

All sentences also should code in AREA B not in AREA A.

Example:

Move P to Temp
Move Q to P
Move temp to Q.



Paragraphs:

It is a block of code which contains one or more sentences or a set of statements.

A Paragraph begins with the paragraph name and ends at the next paragraph starting.

A Paragraph can be ended in another way at another section starts or at the end of the program.

All paragraphs should code in the AREA A.

Syntax: Paragraph-name.


Sections:

It is a block of code which contains one or more paragraphs or a set of sentences or a block of statements.

Section begins with the section name and ends at another section starting or at the end of the program.

All Sections should code in the AREA A.

Syntax: (section-name) SECTION.


Divisions:

It is a block of code which contains one or more sections or a set of sections or set of sentences or a block of statements.

Division begins with the division name and ends at another division starting or at the end of the program.

All divisions should code in the AREA A.

There are four divisions in COBOL

1. Identification Division.

2. Environment Division.

3. Data Division.

4. Procedure Division.

Note:- I will be updating this blog frequently.✍

Thank you for visiting this blog☕️

You Might Also Like

0 comments

TO VIEW THEN CLICK ON IMAGE OF THAT PRODUCT