STOP Statement COBOL

The STOP statement causes a permanent or temporary suspension of the execution of the object program.

STOP Statement

The implicit or explicit usage of both identifier-1 and identifier-2 must be DISPLAY. literal-1 may be numeric or nonnumeric or may be any figurative constant.

If a STOP RUN statement appears in a consecutive sequence of imperative statements within a sentence, it must appear as the last statement in that sequence.

If the RUN phrase is used:

  • The execution of the entire run unit is terminated.
  • integer-1 or the value of the data item referenced by identifier-1 may be zero.
  • When identifier-1 is used in the RUN phrase, it must be the name of an elementary integer data item.
  • The value of the data item referenced by identifier-1or the value of integer-1 is used to set the RETURN-CODE special register. When the run unit is terminated by a STOP RUN or GOBACK statement, the value in the RETURN-CODE special register is made available to the operating system. See the RM/COBOL Use’s Guide for details on using that value.

There is an implicit interaction between the STOP RUN statement and the RETURN-CODE special register. See the discussion of the RETURN-CODE special Register.

If STOP identifier-2 or literal-1 is specified, the value of the operand is displayed at the terminal associated with this run unit and execution of the run unit is suspended until the message is acknowledged. After the message is acknowledged, execution continues with the next executable statement.

STOP Statement Examples



Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

COBOL Topics