ILE COBOL Programmer's Guide

Canceling from Another ILE COBOL Program

In ILE COBOL, you use the CANCEL statement to cancel a subprogram. The subprogram must be in the same activation group as the program that is canceling it in order for the CANCEL statement to work.

After a CANCEL statement for a called subprogram has been executed, that subprogram no longer has a logical connection to the program. The contents of data items in EXTERNAL data records and EXTERNAL files described by the subprogram are not changed when a subprogram is canceled. If a CALL statement is executed later in the run unit naming the same subprogram, that subprogram will be entered in its initial state.

Called subprograms may contain CANCEL statements; however, a called subprogram must not contain a CANCEL statement that directly or indirectly cancels its calling program or any other program higher than itself in the calling hierarchy. If a called subprogram attempts to cancel its calling program, the CANCEL statement in the subprogram is ignored.

A program named in a CANCEL statement must not refer to any program that has been called and has not yet returned control to the calling program. A program can cancel any program that has been called and already returned from, provided that they are in the same activation group. For example:

      A calls B and B calls C            When A receives control,
                                         it can cancel C.
      A calls B and A calls C            When C receives control,
                                         it can cancel B.

Note:
When canceling a program object that contains multiple ILE COBOL programs, only the ILE COBOL program associated with the PEP of the program object is canceled.

Refer to the WebSphere Development Studio: ILE COBOL Reference for a full description of the CANCEL statement.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]