The STOP statement halts execution of the object program either permanently or temporarily.
___ Format _____________________________________________________________ | | | >>__STOP__ _RUN_______ _____________________________________________>< | | |_literal-1_| | | | |________________________________________________________________________|
When STOP literal is specified, the literal is communicated to the operator, and object program execution is suspended. Program execution is resumed only after operator intervention, and continues at the next executable statement in sequence.
The STOP literal statement is useful for special situations (a special tape or disk must be mounted, a specific daily code must be entered, and so forth) when operator intervention is needed during program execution. However, the ACCEPT and DISPLAY statements are preferred when operator intervention is needed.
When STOP RUN is specified, execution of the object program is terminated, and control is returned to the system. If a STOP RUN statement appears in a sequence of imperative statements within a sentence, it must be the last or only statement in the sequence.
The STOP RUN statement closes all files defined in any of the programs comprising the run unit.
For use of the STOP RUN statement in calling and called programs, see the table below.
Termination Statement |
Main Program |
Subprogram |
---|---|---|
STOP RUN |
Return to calling program. (May be the system and cause the application to end.) |
Return directly to the program that called the main program. (May be the system and cause the application to end.) |
>_Host_> When running on OS/390 and using the linkage stack instructions, STOP RUN cannot be used to terminate a COBOL run unit from a subprogram if the linkage stack level has changed from the time the COBOL main program for that run unit was entered. <_Host_<
Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.