How can we help you?

We have hundreds of highly-qualified, experienced experts working in 70+ technologies.

IBM i e-Book

A Developer’s Guide to Mastering IBM i Concepts

Integrated Language Environment

ILE Program Concept

Activation Group:

An activation group is a job sub-structure that includes all ILE and service programs. These sub-structures contain the resources necessary to make the programs execute. These resources can be broadly classified into the following categories:

  • Dynamic storage
  • Static program variables
  • Temporary resources for maintaining data;
  • Certain kinds of exception handlers and ending procedures;

Activation Group Creation:

When you construct your program or service program, you can define an activation group attribute that will control the development of a non-default activation group at runtime. The ACTGRP parameter on the CRTPGM or CRTSRVPGM commands is used to specify the attribute. There is no Create Activation Group command.

One of the following activation group characteristics are used by all ILE programs:

A user-named activation group:

Specified with the ACTGRP(name) parameter. With the help of this feature, you can operate a group of ILE programs and service programs as a single application. When it is initially required, the activation group is formed. Then, every application and service program that uses the same activation group name makes use of it.

A system-named activation group:

Specified using the CRTPGM command’s ACTGRP(*NEW) option. With this feature, each time the program is called, a new activation group can be created. The name of this activation group is chosen by ILE. The name that ILE gave you is unique to your job. The name you select for a user-named activation group doesn’t match with the name assigned to a system-named activation group. Service programs do not support this attribute.

An attribute to use the activation group of the calling program:

specified with the option ACTGRP(*CALLER). With the use of this feature, you can create an ILE program or service program that will be executed within the caller program’s activation group. When a program or service program is activated using this feature, new activation group is never created.

An attribute to choose the activation group appropriate to the programming language and storage model:

Specified with the CRTPGM command’s ACTGRP(*ENTMOD) option. The program entry procedure module specified by the ENTMOD argument is examined when ACTGRP(*ENTMOD) is given. One of the following may occur:

  • If the module attribute is RPGLE, CBLLE, or CLLE, and
    if STGMDL(*SNGLVL) is specified, then QILE is used as the activation group.
  • if STGMDL(*TERASPACE) is specified, then QILETS is used as the activation group.
  • If the module attribute is not RPGLE, CBLLE, or CLLE, then *NEW is used as the activation group.
  • ACTGRP(*ENTMOD) is the default value for this parameter of the CRTPGM command.

Each activation group in a work has a unique name. Once an activation group exists within a job, it is used to activate programs and service programs which has its name specified. Duplicate activation group names are not allowed within a single project due to this architecture.

The ACTGRP parameter on the UPDPGM and UPDSRVPGM commands can be used to change the activation group into which the program or service program is activated.

Default Activation Groups:

The system creates two activation groups that are used by all OPM programs when a job is initiated. Application programs use one of these activation groups. The other is used for operating system programs.

Static program variables are stored in single-level storage through these OPM default activation groups. The OPM default activation groups cannot be removed. They are deleted by the system when your job ends.

If the following requirements are met, ILE programs and service programs can be activated in the OPM default activation groups:

  • The ILE programs or service programs were created with the activation group *CALLER option or with the DFTACTGRP(*YES) option.
  • The call to the ILE programs or service programs originates in the OPM default activation groups.
  • The ILE program or service program does not use the teraspace storage model.

The operating system will also create a teraspace default activation group when it determines one is needed.
Static program variables are stored in teraspace by the teraspace default activation group.

You cannot delete the teraspace default activation group. When your job is terminated, the system will remove it. If the following requirements are met, ILE programs and service programs may be activated in the Teraspace default activation group:

  • The ILE program or service program was created with the activation group *CALLER option.
  • The state of the ILE program or service program is *USER.

For the ILE program or service program to be activated into the teraspace default activation group, one of the following criteria must also be satisfied:

  • The call to the ILE program or service program originates in the teraspace default activation group and the ILE program or service program was created with either the storage model *INHERIT or the storage model *TERASPACE option.
  • The ILE program or service program was created with the storage model *INHERIT option, there are no application entries on the call stack associated with a different activation group and the activation occurs in preparation for one of these invocations:
    1. SQL stored procedure
    2. SQL function
    3. SQL trigger
  • The ILE program or service program was created with the storage model *TERASPACE option and there are no call stack entries associated with a teraspace storage model activation group. See Selecting a Compatible Activation Group for additional information.

Non-Default Activation Group Deletion

Activation groups require resources to be created within a job. If an application can reuse an activation group, processing time could be reduced.
To enable you to exit an invocation without terminating or erasing the related activation group, ILE offers various options.

Whether the activation group is deleted depends on the type of activation group and the method in which the application ended.

The following are various ways for an application to go back to a call stack entry linked to a different activation group:

  • 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 or RETURN command in CL.
  • Skip operations:For example, sending an exception message or branching to a call stack entry that is not associated with your activation group.

Activation groups can be removed from an application by executing API CEETREC or by utilizing HLL end verbs. Moreover, deletion of your activation group may result from an unhandled exception.

As long as the closest control boundary is the oldest call stack entry connected to the activation group, these actions will always remove your activation group. Control moves to the call stack entry that comes before the control boundary if the closest control boundary is not the oldest call stack item. The activation group isn’t eliminated, though.

Example: ILEACT(Main PGM)

ILEACTPGM1:

ILEACTPGM2:

Output :

WRKJOB (Take Option 18 to see Activation Group)

Before Calling Main Program

After Calling Main Program

How can we help you?

We have hundreds of highly-qualified, experienced experts working in 70+ technologies.

X

Awards and Certifications

company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo
company-logo