Flow of Control

Execution of a program begins at the first paragraph encountered outside of Declaratives. Statements are executed in order except when an explicit or implicit transfer of control occurs. The program halts when there is no next statement available to execute.

The following methods of implicit control are used by COBOL.

  1. If a paragraph is being executed under control of another COBOL statement (such as a PERFORM) and the paragraph is the last in the range of the controlling statement, then an implied transfer of control occurs from the last statement in the paragraph to the control mechanism of the controlling statement.
  2. When any COBOL statement is executed which results in the execution of a Declarative section, an implicit transfer of control to that Declarative section occurs. After the section completes, another implicit transfer of control occurs to the statement immediately after the statement that caused the Declarative to execute.

An explicit transfer of control occurs in response to certain COBOL statements such as GO TO and PERFORM. The rules for transfer are described under the appropriate verbs. All conditional and delimited-scope statements also perform explicit transfer of control based on some condition.