The CANCEL verb places a program into its initial state.
Format 1
CANCEL {program-name} ...
Syntax Rule
program-name is a nonnumeric literal or an alphanumeric data item. It may not be an ALL literal.
General Rules
- After a CANCEL verb executes, the affected programs are placed into their initial states. This closes any open files contained
in the cancelled program and ensures that any VALUE clauses are in effect when those programs are called again. By default,
memory used by the programs is released. If the mechanism for logical cancels is enabled, the programs are cached in memory.
For information about the effects and use of
logical cancels, see Memory Management.
- In Format 1, each program-name refers to the CALL name of a program to cancel. For more information, see Calling Subprograms.
- In Format 2, every program that has been called but is not active is cancelled. A program is active if it has been called
(or is the initial program of the run) and has not yet exited.
Note: The CANCEL_ALL_DLLS configuration variable can be used to exclude DLLs and shared object libraries from the results of the
CANCEL ALL statement. See
CANCEL_ALL_DLLS for details.
- A CANCEL statement is ignored if it refers to an active program. A CANCEL statement may also refer to a program that has never
been active. Such a reference has no effect.
- A CANCEL statement has no effect on a program that has a RESIDENT phrase in its PROGRAM-ID paragraph.
- When you cancel a program that exists in more than one thread, it is canceled only in the current thread. CANCEL ALL cancels
only programs in the current thread. If a program is active in any thread that it shares data with, the CANCEL will have no
effect.
- In Format 3, any active sort is terminated. Only one sort may be active at a time; using Format 3 guarantees that no sort
is active, and thus prepares you to initiate a new sort safely.