Enterprise COBOL for z/OS, V4.2, Language Reference

STOP statement

The STOP statement halts execution of the object program either permanently or temporarily.

Read syntax diagramSkip visual syntax diagram
Format

>>-STOP--+-RUN-----+-------------------------------------------><
         '-literal-'   

literal
Can be a fixed-point numeric literal (signed or unsigned) or an alphanumeric literal. It can be any figurative constant except ALL literal.

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 when operator intervention is needed during program execution; for example, when a special tape or disk must be mounted or a specific daily code must be entered. However, the ACCEPT and DISPLAY statements are preferred when operator intervention is needed.

Do not use the STOP literal statement in programs compiled with the THREAD compiler option.

When STOP RUN is specified, execution is terminated and control is returned to the system. When STOP RUN is not the last or only statement in a sequence of imperative statements within a sentence, the statements following STOP RUN are not executed.

The STOP RUN statement closes all files defined in any of the programs in the run unit.

For use of the STOP RUN statement in calling and called programs, see the following table.

Termination statement Main program Subprogram
STOP RUN Returns to the calling program. (Can be the system, which causes the application to end.) Returns directly to the program that called the main program. (Can be the system, which causes the application to end.)


Rate this page

[ Index | Table of contents ]