COBOL Programming Construction

COBOL COMP-3 COBOL Sequence Programming Construction

Advertisements


Program is set of executable statements which will execute in a sequence.

In day to day needs, the program execution also needs a change from how it is executing earlier like

  1. Some part of the code needs to be executed in sequence.
  2. Some part of the statements needs to execute based on conditions.
  3. Some part of the statements needs to be executed repeatedly.

Based on the above needs, programming construction mainly divided into below three types.

  1. Sequence
  2. Selection
  3. Iteration

Every COBOL control statement also exactly fits to these three types of programming construction.

Let’s discuss what control statements are exactly fits to the above three types the programming construction.

Let’s start with Sequence programming construction.

Sequence programming Construction:

Sequence programming construction involves making the program execution in sequence.

Single line executable statements are the part of Sequence programming construction.

The best sequence execution commands in COBOL are

	1.  ACCEPT
	2.  CALL
	3.  COMPUTE
	4.  DISPLAY
	5.  EXIT PROGRAM
	6.  GO BACK
	7.  INITIALIZE
	8.  INSPECT
	9.  EXAMINE
	10. MOVE
	11. STRING
	12. UNSTRING
	13. All arithmetic statements like ADD, SUBTRACT, MULTIPLY, DIVIDE etc,.

The sequence programming construction topic explained in detail here

Selective Programming Construction:

The statements in the program are running in a sequence until or unless if any statement executed in the flow that will alter the execution sequence.

In the program, there might be some need to execute some set of statements in a selective manner. i.e. based on some conditions.

COBOL has a special set of commands for the selective programming as well like below.

	1. IF
	2. EVALUATE

The selective programming construction topic explained in detail here

Iterative programming Construction:

The statements in the program are running in a sequence until or unless if any statement executed in the flow that will alter the execution sequence.

In the program, there might be some need to execute some set of statements in a repetitive/iterative manner. i.e. based on some requirement.

PERFORM statement is the best example for Iterative programming construction.

The selective programming construction topic explained in detail here


If any questions on the above, post your queries on Cobol Discussion forum


COBOL COMP-3 COBOL Sequence Programming Construction

Advertisements