Rational Developer for System z
COBOL for Windows, Version 7.5, Language Reference


Transfer of control

In the procedure division, unless there is an explicit control transfer or there is no next executable statement, program flow transfers control from statement to statement in the order in which the statements are written. This normal program flow is an implicit transfer of control.

In addition to the implicit transfers of control between consecutive statements, implicit transfer of control also occurs when the normal flow is altered without the execution of a procedure branching statement. The following examples show implicit transfers of control, overriding statement-to-statement transfer of control:

COBOL also provides explicit control transfers through the execution of any procedure branching, program call, or conditional statement. (Lists of procedure branching and conditional statements are contained in Statement categories.)

Definition: The term next executable statement refers to the next COBOL statement to which control is transferred, according to the rules given above. There is no next executable statement under the following circumstances:

When there is no next executable statement and control is not transferred outside the COBOL program, the program flow of control is undefined unless the program execution is in the nondeclarative procedures portion of a program under control of a CALL statement, in which case an implicit EXIT PROGRAM statement is executed.

Similarly, if control reaches the end of the procedure division of a method and there is no next executable statement, an implicit EXIT METHOD statement is executed.


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)