An activation group on IBM i (AS/400) is a runtime memory environment where one or more programs execute together. It's a way the IBM i operating system manages the lifecycle of programs, especially those written in ILE languages like RPGLE, CLLE, SQLRPGLE, and service programs.
🧠 Simple Definition:
An activation group is like a container in memory that holds running programs. Programs in the same activation group can share resources and stay active together.
✅ Why Activation Groups Matter
Purpose | Explanation |
---|---|
Memory management | Controls how long programs and service programs stay in memory |
Program sharing | Programs in the same group can share files, variables, procedures |
Isolation | Separate activation groups don’t interfere with each other |
Performance | Reusing activation groups can reduce loading time |
Resource cleanup | Ending an activation group frees all resources at once |
🛠 Types of Activation Groups
Type | Meaning | Use Case |
---|---|---|
*DFTACTGRP |
Default activation group (like OPM) | Simple, traditional programs |
*NEW |
Creates a new activation group | Keeps the program isolated |
Named group |
Reuses a named group (e.g., 'MYACTGRP' ) |
For modular ILE applications |
*CALLER |
Inherits the caller’s activation group | Used in service programs / APIs |
🔁 Example
1. RPGLE Program
ctl-opt actgrp('CUSTGRP'); // Named activation group
This RPG program will run inside the activation group CUSTGRP
.
2. When you call it:
-
If
CUSTGRP
doesn't exist, IBM i creates it. -
If it does exist, the program runs inside the existing group.
-
When
CUSTGRP
is ended (viaRCLACTGRP
or job end), all programs in it are unloaded.
🔐 Commands for Activation Groups
-
See active groups:
WRKACTJOB
-
End a specific group:
RCLACTGRP ACTGRP(CUSTGRP)
-
End all groups (except default):
RCLACTGRP ACTGRP(*ELIGIBLE)
⚠️ Best Practices
Practice | Why |
---|---|
Use *CALLER for service procs |
Keeps service logic consistent with caller |
Avoid *DFTACTGRP for modern ILE |
Limits modular and reusable programming |
Isolate APIs in named groups | Makes REST/service jobs more stable |
Use *NEW for one-time runs |
Avoid shared memory bugs in testing |
Would you like a visual diagram of how activation groups interact between main programs and service programs — or how to debug memory issues caused by them?