Canceling a subprogram
When you issue a CANCEL statement for
a subprogram, the storage that is occupied by the subprogram is freed.
A subsequent call to the subprogram functions as though it were the
first call. You can cancel a subprogram from a program other than
the original caller.
If the called subprogram has more than one entry point,
ensure that an intervening CANCEL statement is executed
before you specify different entry points in a dynamic CALL statement
to that subprogram.
After a CANCEL statement
is processed for a dynamically called contained program, the program
will be in its first-used state. However, the program is not loaded
with the initial call, and storage is not freed after the program
is canceled.
Examples: static and dynamic CALL statements