COBOL provides both explicit and implicit means of altering the implicit control transfer mechanism.
1. If a paragraph is being executed under control of another COBOL statement such as PERFORM, USE, and SORT, and the paragraph is the last paragraph 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 last executed controlling statement. Further, if a paragraph is being executed under the control of a PERFORM Statement that causes iterative execution, and that paragraph is the first paragraph in the range of that PERFORM Statement, an implicit transfer of control occurs between the control mechanism associated with that PERFORM Statement and the first statement in that paragraph for each iterative execution of the paragraph.
2. NOTE - Another implicit transfer of control occurs after execution of the declarative section, as described in rule 1 above.An explicit transfer of control consists of an alteration of the implicit control transfer mechanism by the execution of a procedure branching or conditional statement. An explicit transfer of control may be caused only by the execution of a procedure branching or conditional statement. The procedure branching statement EXIT PROGRAM causes an explicit transfer of control only when the statement is executed in a called program.If control is transferred either implicitly or explicitly to a paragraph containing no statements, execution proceeds as if the paragraph contained only a single sentence consisting of a CONTINUE Statement.There is no next executable statement when the execution of an EXIT PROGRAM, GOBACK, or STOP Statement transfers control outside the COBOL source element.In the declarative section, there is no next executable statement after either the last statement when the paragraph in which it appears is not being executed under the control of some other COBOL statement, or the last statement when the statement is in the range of an active PERFORM Statement executed in a different section and this last statement of the declarative section is also not the last statement of the procedure that is the exit of the active PERFORM Statement. In these cases the flow of control is undefined.There is also no next executable statement after the last statement in a source element when the paragraph in which it appears is not being executed under the control of some other COBOL statement in that source element, after the end marker, and if there are no procedure division statements in a program, function, or method. In these cases, an implicit GOBACK Statement without any optional phrases is executed.
| Copyright (c) 2017 Veryant |
| Contact us |
|
Please share your comments on this manual or on any Veryant product documentation with the email button at the top left |