Pages

Monday, June 1, 2020

What is Activation Group?

Activation Groups on IBM i:

Activation group works like a Sub environment which allows sharing the open resources and/or overrides with across programs called in the Activation Group. 

Activation groups are one of important concepts on ILE on IBM i and makes it different from OPM in terms of how resources are shared with calling programs. 

E.g.:

We will consider a scenario of Batch Job which processes pending transactions in a Specific Application. 

Driver Program of Batch Job can create Overrides (OVRDBF) and/or Open Query (OPNQRYF) on a file with a set of conditions and calls multiple programs for processing different transactions. 

Considering the Overrides are created to share the resources across Activation Group (*ACTGRP), Result set of table (on top of OPNQRYF) would be made available to all the programs called in the specific activation group and avoids the need to perform override in every program.

When a program is created, we can choose on how the program needs to be run (in terms of Activation Group).
  • Default Activation Group
  • New Activation Group
  • Caller Activation Group
  • Named Activation Group
  • QILE/QILETS
We will see about each of these in detail.

Default Activation Group (DFTACTGRP):

This Keyword specifies whether program needs to run in the Default Activation Group of a Specific Activation Group.
  • When *YES is specified, Program will always run in the Default Activation Group. This option makes the program to run like OPM. This would also mean we cannot use BNDDIR or ACTGRP while creating the Program 
  • When *NO is specified, Program will be associated with the Activation Group mentioned in ACTGRP keyword. This is very useful in order to take the advantage of most of the ILE concepts. 
E.g.: DFTACTGRP keyword on CRTBNDRPG
CRTBNDRPG PGM(NEWPGM) SRCFILE(SRCLIB/QRPGLESRC) DFTACTGRP(*YES)

CRTBNDRPG PGM(NEWPGM) SRCFILE(SRCLIB/QRPGLESRC) DFTACTGRP(*NO) ACTGRP(*NEW)

New Activation Group (*NEW):

Specifying '*YES' on DFTACTGRP Keyword would allow the programmer to specify required Activation Group in ACTGRP parameter. 

'*NEW' would create the new activation group every time the Program is called. And, System would randomly create Activation group name and cannot be specified by programmer.

If the Program is called by two different users at the same time, Two new Activation Groups are created.

Caller Activation Group (*CALLER):

'*CALLER' on ACTGRP would make the program to run under the Activation Group determined by the Calling program. 

E.g.: If PGM2 is compiled with ACTGRP(*CALLER), PGM1 is compiled with ACTGRP(*NEW) and PGM2 is called from PGM1,

When PGM1 is called, System would create new Activation Group and when PGM2 is called, PGM2 will run under the same Activation Group (created by PGM1).

Named Activation Group:

Name of the Activation Group can be determined the Programmer as required by Application. 
CRTBNDRPG PGM(NEWPGM) SRCFILE(SRCLIB/QRPGLESRC) DFTACTGRP(*NO) ACTGRP(ACT1)
If the Application is to run under specific Activation group, Driver program for the program for the application can be compiled with specific Name in Activation Group and the calling programs can be compiled using ACTGRP(*CALLER)

QILE/QILETS:

QILE/QILETS are the Activation groups created by IBM. These can be used if there is no specific requirement for Activation group and to utilize the advantages of ILE concepts (as Default Activation Group makes the program to behave like OPM).

  • Q denotes this is Activation Group created by IBM.
  • ILE denotes to Integrated Language Environment.
  • TS denotes to Teraspace.

QILE/QILETS cannot be directly specified by the programmer. Storage Model (STGMDL) would determine if the program needs to compile with QILE or QILETS. Below are the possible options for Storage Model.
  • *SNGLVL - The program is created with single-level storage model.  When a single-level storage model program is activated and run, it is supplied single-level storage for automatic and static storage. A single-level storage program runs only in a single-level storage activation group.
  • *TERASPACE - The program is created with teraspace storage model.  When a teraspace storage model program is activated and run, it is supplied teraspace storage for automatic and static storage. teraspace storage program runs only in a teraspace storage activation group.
  • *INHERIT - The program is created with inherit storage model. When activated, Program adopts the storage model it is activated into. When this is selected, ACTGRP(*CALLER) must be selected.
If STGMDL(*TERASPACE) is specified, the program will be activated into the QILETS activation group when it is called. Otherwise this program will be activated into the QILE activation group when it is called.

CRTBNDRPG PGM(NEWPGM) SRCFILE(SRCLIB/QRPGLESRC) DFTACTGRP(*NO) 
ACTGRP(*STGMDL) STGMDL(*TERASPACE)

Popular Posts