



The EXIT PROGRAM statement specifies the end of a called program and returns control to the calling program.
You can specify EXIT PROGRAM only in the Procedure Division of a program. It must not be used in a declarative procedure in which the GLOBAL phrase is specified.
___ Format _____________________________________________________________
| |
| >>__EXIT PROGRAM.___________________________________________________>< |
| |
|________________________________________________________________________|
If control reaches an EXIT PROGRAM statement in a program that does not
possess the INITIAL attribute while operating under the control of a CALL
statement (that is, the CALL statement is active), control returns to the
point in the calling program immediately following the CALL statement.
The program state of the calling program is identical to that which
existed at the time it executed the CALL statement. The contents of data
items and the contents of data files shared between the calling and called
program could have been changed. The program state of the called program
is not altered except that the ends of the ranges of all PERFORM
statements executed by that called program are considered to have been
reached.
The execution of an EXIT PROGRAM statement in a called program that possesses the INITIAL attribute is equivalent also to executing a CANCEL statement referencing that program.
If control reaches an EXIT PROGRAM statement, and no CALL statement is active, control passes through the exit point to the next executable statement.
If a subprogram specifies the Procedure Division RETURNING phrase, the value in the data item referred to by the RETURNING phrase becomes the result of the subprogram invocation.
When there is no next executable statement in a called program, an implicit EXIT PROGRAM statement is executed.
© Copyright IBM Corp. 1991, 1998
Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.