Friday, September 4, 2009

The CANCEL Statement
Syntax
Format
CANCEL { identifier-1
literal-1 }

Description
The CANCEL statement is used to remove subroutines from memory when they are no longer needed. The subroutine to be cancelled is determined by the operand. All memory allotted to the given program is relinquished.

Tips
1. The CANCEL statement can be used to reset all the variables in a subroutine between CALLs of the routine; however, this is inefficient in that it requires the program to be loaded back into memory before execution can occur. It is better to initialize such items at the beginning of the PROCEDURE DIVISION instead.
2. Use the CANCEL to free up memory when there isn't enough available to load another subprogram.