CANCEL Statement COBOL

The CANCEL statement ensures that the next time the referenced programs are called they will be in their initial state.For a separately compiled program, the CANCEL statement releases the memory areas occupied by the referenced programs.

CANCEL Statement

literal-1 must be a nonnumeric literal.

identifier-1 must be defined as an alphanumeric data item such that its value can be a program-name.

Subsequent to the execution of a CANCEL statement, the programs it refers to cease to have a logical relationship to the run unit in which the CANCEL statement appears.A subsequently executed CALL statement naming such a program results in that program being initiated in its initial state.The memory areas associated with the named programs are released so as to be made available for disposition by the runtime system.

A program named in a CANCEL statement in another program must be callable by that other program.

When an explicit or implicit CANCEL statement is executed, all programs contained within the program referenced by the CANCEL statement are also canceled.The result is the same as if a valid CANCEL statement were executed for each contained program in the reverse order in which the programs appear in the separately compiled program.

A program named in the CANCEL statement must not refer to any program that has been called and has not yet executed an EXIT PROGRAM statement.

A logical relationship to a canceled subprogram is established only by execution of a subsequent CALL statement.A called program is canceled either by being referred to as the operand of a CANCEL statement, by the termination of the run unit of which the program is a member or by execution of an EXIT PROGRAM statement in a called program that possesses the initial attribute.

No action is taken when a CANCEL statement is executed naming a program that has not been called in this run unit or has been called and is at present canceled.Control passes to the next statement.

The contents of data items in external data records described by a program are not changed when that program is canceled.

During execution of an explicit or implicit CANCEL statement, an implicit CLOSE statement without any optional phrases is executed for each file in an open mode that is associated with an internal file connector in the program named in the explicit CANCEL statement or implied in the implicit CANCEL statement.Any USE procedures associated with any of these files are not executed.

CANCEL 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