ILE COBOL Programmer's Guide

Control Boundaries

All ILE languages, including ILE COBOL, use a common mechanism called the call stack for transferring control to and from called ILE procedures or OPM program objects. The call stack consists of a last-in, first-out list of call stack entries, one entry for each called ILE procedure or program object. Each call stack entry has information about the automatic variables for the ILE procedure, and other resources scoped to the call stack entry such as condition handlers and cancel handlers.

In ILE COBOL, each ILE COBOL program or nested program that is called has one call stack entry. Each declarative that is called also has its own call stack entry.

A call adds a new entry on the stack for the called ILE procedure or OPM program object and passes control to the called object. A return removes the call stack entry and passes control back to the called ILE procedure or program object in the previous call stack entry.

In ILE, you can create an application that runs program objects in multiple activation groups. You can call an ILE COBOL program object that is running in a different activation group from that of the calling program. In this case, the call stack entry for the called program object is known as a control boundary. A control boundary is defined as any ILE call stack entry for which the immediately preceding call stack entry is for an ILE procedure or program object in a different activation group. An ILE call stack entry for which the immediately preceding call stack entry is for an OPM program object is also a control boundary.

If the called program object is the first program object to be activated in a particular activation group, then its call stack entry is known as a hard control boundary. If the called program object, which is a control boundary, is not the first program object to be activated in an activation group, then its call stack entry is known as a soft control boundary. The main program of a run unit that is compatible with and OPM COBOL/400 run unit is found at the hard control boundary of the activation group.

When a STOP RUN statement (or a GOBACK statement in a main ILE COBOL program) is encountered in a called ILE COBOL program, control is transferred to the caller of the control boundary. In a run unit that is compatible with an OPM COBOL/400 run unit, STOP RUN will end the run unit.

An implicit COMMIT operation is performed on files under commitment control if commitment control is scoped to the activation group and the activation ends normally with no errors closing the files. A ROLLBACK operation is performed if the activation group ends abnormally or there are errors closing the files. Nothing happens if commitment control is scoped to the job.

The control boundary is also where an unhandled error is turned into a function check. When the function check is again unhandled, then, at the control boundary, it will be changed to the generic ILE failure condition, CEE9901, and sent to the caller of the control boundary.


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