Format 3 (method)
The EXIT METHOD statement specifies the end of an invoked method.
You can specify EXIT METHOD only in the PROCEDURE DIVISION of a method. EXIT METHOD causes the executing method to terminate, and control returns to the invoking statement. If the containing method specifies the PROCEDURE DIVISION RETURNING phrase, the value in the data item referred to by the RETURNING phrase becomes the result of the method invocation.
If you need method-specific data to be in the last-used state on each invocation, define it in method WORKING-STORAGE. If you need method-specific data to be in the initial state on each invocation, define it in method LOCAL-STORAGE.
If control reaches an EXIT METHOD statement in a method definition, control returns to the point that immediately follows the INVOKE statement in the invoking program or method. The state of the invoking program or method is identical to that which existed at the time it executed the INVOKE statement.
The contents of data items and the contents of data files shared between the invoking program or method and the invoked method could have changed. The state of the invoked method is not altered except that the end of the ranges of all PERFORM statements executed by the method are considered to have been reached.
The EXIT METHOD statement does not have to be the last statement in a sequence of imperative statements, but the statements following the EXIT METHOD will not be executed.
When there is no next executable statement in an invoked method, an implicit EXIT METHOD statement is executed.