


The CANCEL verb places a program into its initial state.
General Format
Format 1
CANCEL {program-name} ...
Format 2
CANCEL ALL
Format 3
CANCEL SORT
Syntax Rules
1. Program-name is a nonnumeric literal or an alphanumeric data item. It may not be an ALL literal.
General Rules
2. After a CANCEL verb executes, the affected programs are placed into their initial states. This closes any open files contained in the canceled program and ensures that any VALUE clauses are in effect when those programs are called again. This also causes any memory used by those programs to be released.
3. In Format 1, each program-name refers to the CALL name of a program to cancel. For more information, see the entry in this section for the "CALL Statement," and ACUCOBOL-GT User's Guide section 2.9, "Calling Subprograms."
4. In Format 2, every program that has been called but is not active is canceled. A program is active if it has been called (or is the initial program of the run) and has not yet exited.
5. 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.
6. A CANCEL statement has no effect on a program that has a RESIDENT phrase in its PROGRAM-ID paragraph.
7. 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.
8. 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.