ILE COBOL Language Reference

LINKAGE TYPE Phrase

+-------------------------------IBM Extension--------------------------------+

The LINKAGE TYPE phrase is used to specify the type of program that the CANCEL statement targets. It could target a program object (*PGM) or an ILE procedure.

environment-name-1
The type of program that the CANCEL statement will affect. Environment-name-1 can be defined as:
PGM
A program object (*PGM)
PRC
An ILE procedure
PROGRAM
A program object (*PGM) is canceled.
PROCEDURE
An ILE procedure is canceled.

If the LINKAGE TYPE phrase is not specified on the CANCEL statement, the type of program canceled can be changed by specifying one of: the LINKAGE TYPE clause of the SPECIAL-NAMES paragraph, or the LINKLIT parameter of the CRTCBLMOD or CRTBNDCBL command.

+----------------------------End of IBM Extension----------------------------+

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 described by the subprogram are not changed when a subprogram is canceled. If a CALL statement is executed later by any program in the run unit naming the same subprogram, that subprogram will be entered in its initial state.

A CANCEL statement closes all open INTERNAL files.

You can cancel a called subprogram in any of the following ways:

A CANCEL statement operates only on the program specified, and not on any program that may have been called by the canceled program.

Called subprograms may contain CANCEL statements. 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. 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.)

No action is taken when a CANCEL statement is executed naming a program that has not been called in the run unit, or that names a program that was called and subsequently canceled. In both cases, control passes to the next statement.

See the ILE COBOL for AS/400 Programmer's Guide for more information on canceling procedures and program objects.


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