Non-Default Activation Group Deletion

Activation groups require resources to be created within a job. Processing time may be saved if an activation group can be reused by an application. ILE provides several options to allow you to return from an invocation without ending or deleting the associated activation group. Whether the activation group is deleted depends on the type of activation group and the method in which the application ended.

An application may return to a call stack entry (see Call Stack) associated with another activation group in the following ways:

  • HLL end verbs

    For example, STOP RUN in COBOL or exit() in C.

  • Call to API CEETREC
  • Unhandled exceptions

    Unhandled exceptions can be moved by the system to a call stack entry in another activation group.

  • Language-specific HLL return statements

    For example, a return statement in C, an EXIT PROGRAM statement in COBOL, or a RETURN statement in RPG.

  • Skip operations

    For example, sending an exception message or branching to a call stack entry that is not associated with your activation group.

You can delete an activation group from your application by using HLL end verbs or by calling API CEETREC. An unhandled exception can also cause your activation group to be deleted. These operations will always delete your activation group, provided the nearest control boundary is the oldest call stack entry associated with the activation group (sometimes called a hard control boundary). If the nearest control boundary is not the oldest call stack entry (sometimes called a soft control boundary), control passes to the call stack entry prior to the control boundary. However, the activation group is not deleted.

A control boundary is a call stack entry that represents a boundary to your application. ILE defines control boundaries whenever you call between activation groups. Refer to Control Boundaries for a definition of a control boundary.

A user-named activation group may be left in the job for later use. For this type of activation group, any normal return or skip operation past a hard control boundary does not delete the activation group. In contrast, use of those same operations within a system-named activation group causes the activation group to be deleted. System-named activation groups are deleted because you cannot reuse them by specifying the system-generated name. For language-dependent rules about a normal return from the oldest call stack entry associated with an activation group, refer to the ILE HLL programmer’s guides.

Figure 1 shows examples of how to leave an activation group. In the figure, procedure P1 is the oldest call stack entry. For the system-named activation group (created with the ACTGRP(*NEW) option), a normal return from P1 deletes the associated activation group. For the user-named activation group (created with the ACTGRP(name) option), a normal return from P1 does not delete the associated activation group.

Figure 1. Leaving User-Named and System-Named Activation Groups

If a user-named activation group is left in the job, you can delete it by using the Reclaim Activation Group (RCLACTGRP) command. This command allows you to delete named activation groups after your application has returned. Only activation groups that are not in use can be deleted with this command.

Figure 2 shows a job with one activation group that is not in use and one activation group that is currently in use. An activation group is considered in use if there are call stack entries associated with programs activated within that activation group. Using the RCLACTGRP command in program A or program B deletes the activation group for program C and program D.

Figure 2. Activation Groups In Use Have Entries on the Call Stack

When an activation group is deleted by ILE, certain end-operation processing occurs. This processing includes calling user-registered exit procedures, data management cleanup, and language cleanup (such as closing files). Refer to Data Management Scoping Rules for details on the data management processing that occurs when an activation group is deleted.