PROGRAM_RESOLVED_ACTIVATIONS table function
The PROGRAM_RESOLVED_ACTIVATIONS table function returns information about the service programs that need to be activated for a given ILE program or service program. The table function returns a row for each service program that would be statically activated. In addition, it can return rows for service programs defined with deferred activation.
This table function is similar to the BOUND_SRVPGM_INFO view in that it returns information about service programs bound to an ILE program or service program. However, the BOUND_SRVPGM_INFO view returns the definitional bind information, while PROGRAM_RESOLVED_ACTIVATIONS returns the entire network of activations. In other words, what is returned is the program's entire activation chain which is the list of all service programs that will be activated for the given ILE program or service program.
The PROGRAM_RESOLVED_ACTIVATIONS table function performs a static analysis of the input program to determine the set of bound service programs that must also be activated. It does not attempt to simulate the precise set or ordering of activations that will be done at run time. If the given program or service program dynamically activates an export in a service program, that service program's activation chain is not included in the results of this table function.
If a row is returned where BOUND_SERVICE_PROGRAM_LIBRARY has a value of *LIBL, the library list of the thread that invokes the table function is used to find the service program. If the library list is not the same as the library list used when the program is activated at run time, the expected service program might not be found.
If the RESOLVED_SERVICE_PROGRAM_LIBRARY column contains the null value for any row, the network of activations returned by this table function might be incomplete.
No other system interface returns this information.
- *EXECUTE authority to the library containing the program or service program
- *READ authority to the program or service program
- *EXECUTE authority to the library containing the service program
- *READ authority to the service program
- program-library
- A character string expression that specifies the name of the library that contains program-name.
- program-name
- A character string expression that specifies the name of the program or service program whose activations are to be obtained.
- object-type
- A character string expression that specifies the type of object for program-name.
- *PGM
- The object is a program.
- *SRVPGM
- The object is a service program.
- deferred-service-programs
- A character string that specifies whether the table function should follow the dependency chain
into service programs that are bound with deferred activation requested. These are service programs
that had *DEFER on the BNDSRVPGM parameter of CRTPGM or CRTSRVPGM commands or in a binding directory
entry.
- NO
- Do not follow deferred activations.
- YES
- Follow deferred activations. This is the default.
- ignore-errors
- A character string expression that identifies what to do when an error is encountered.
- NO
- An error is returned.
- YES
- A warning is returned.
The result of the function is a table containing one or more rows with the format shown in the following table.
| Column Name | Data Type | Description |
|---|---|---|
| LEVEL | INTEGER | A value that indicates the depth of nesting for this row. Rows for the input program name will have a value of 1. Rows for bound service programs used by row 1 will have a value of 2, and so on. |
| PROGRAM_LIBRARY | VARCHAR(10) | The library containing the PROGRAM_NAME. |
| PROGRAM_NAME | VARCHAR(10) | The name of the program or service program whose bound service
programs are being retrieved. One row reflects the input program name. The other rows contain the name of a BOUND_SERVICE_PROGRAM column from a row with a smaller LEVEL value as the table function recurses through the input program's bound service programs. |
| OBJECT_TYPE | VARCHAR(7) | The type of PROGRAM_NAME.
|
| BOUND_SERVICE_PROGRAM_LIBRARY | VARCHAR(10) | The name of the library containing the service program bound to
PROGRAM_NAME. This is the library where the activation expects to find the service program at run
time. This column can contain the following special value:
Contains the null value if the service program bound to PROGRAM_NAME cannot be retrieved. |
| BOUND_SERVICE_PROGRAM | VARCHAR(10) | The name of the service program bound to PROGRAM_NAME. Contains the null value if the service program bound to PROGRAM_NAME cannot be retrieved. |
| BOUND_SERVICE_PROGRAM_ACTIVATION | VARCHAR(6) | Specifies how activation of the bound service program (the
BOUND_SERVICE_PROGRAM column) was specified at the time of PROGRAM_NAME's creation.
Contains the null value if the service program bound to PROGRAM_NAME cannot be retrieved. |
| RESOLVED_SERVICE_PROGRAM_LIBRARY | VARCHAR(10) | The name of the library where BOUND_SERVICE_PROGRAM was found if
BOUND_SERVICE_PROGRAM_LIBRARY is *LIBL. Otherwise, it is the same as BOUND_SERVICE_PROGRAM_LIBRARY.
Contains the null value if :
|
Examples
- List the complete activation chain for QGPL/MYPGM that shows each service program in the chain
and the service programs it activates. If any service program to be activated does not exist, is not
in the library list, or the user is not authorized to the object, the
RESOLVED_SERVICE_PROGRAM_LIBRARY column will be
null.
SELECT * FROM TABLE(QSYS2.PROGRAM_RESOLVED_ACTIVATIONS( PROGRAM_LIBRARY => 'QGPL', PROGRAM_NAME => 'MYPGM', OBJECT_TYPE => '*PGM')); - Get a sorted list of the service programs that will be statically activated when program
QGPL/MYPGM runs.
SELECT DISTINCT PROGRAM_LIBRARY, PROGRAM_NAME, OBJECT_TYPE FROM TABLE(QSYS2.PROGRAM_RESOLVED_ACTIVATIONS( PROGRAM_LIBRARY => 'QGPL', PROGRAM_NAME => 'MYPGM', OBJECT_TYPE => '*PGM')) ORDER BY PROGRAM_LIBRARY, PROGRAM_NAME; - Return rows from the activation chain for MYLIB/MYPGM, where there is a bound service program
that is not explicitly qualified.
SELECT PROGRAM_LIBRARY, PROGRAM_NAME, OBJECT_TYPE, BOUND_SERVICE_PROGRAM_LIBRARY, BOUND_SERVICE_PROGRAM FROM TABLE(QSYS2.PROGRAM_RESOLVED_ACTIVATIONS( PROGRAM_LIBRARY => 'MYLIB', PROGRAM_NAME => 'MYPGM', OBJECT_TYPE => '*PGM')) WHERE BOUND_SERVICE_PROGRAM_LIBRARY = '*LIBL' ORDER BY PROGRAM_LIBRARY, PROGRAM_NAME; - Return rows from the activation chains for all programs in MYLIB where there is a bound service
program that is not explicitly qualified.
SELECT OBJNAME AS PROGRAM_IN_MYLIB, PROGRAM_LIBRARY, PROGRAM_NAME, BOUND_SERVICE_PROGRAM_LIBRARY, BOUND_SERVICE_PROGRAM FROM TABLE(QSYS2.OBJECT_STATISTICS( 'MYLIB', '*PGM', '*ALLSIMPLE')), TABLE(QSYS2.PROGRAM_RESOLVED_ACTIVATIONS( PROGRAM_LIBRARY => OBJLIB, PROGRAM_NAME => OBJNAME, OBJECT_TYPE => OBJTYPE)) WHERE BOUND_SERVICE_PROGRAM_LIBRARY = '*LIBL' ORDER BY PROGRAM_IN_MYLIB, PROGRAM_LIBRARY, PROGRAM_NAME; - Determine whether one or more bound service programs in the activation chain for MYPGM in XYZ
reside in a library that is not XYZ or QSYS. There will always be some rows for QSYS since system
service programs are part of the activation chain.
SELECT DISTINCT PROGRAM_LIBRARY, PROGRAM_NAME, RESOLVED_SERVICE_PROGRAM_LIBRARY, BOUND_SERVICE_PROGRAM FROM TABLE(QSYS2.PROGRAM_RESOLVED_ACTIVATIONS( PROGRAM_LIBRARY => 'XYZ', PROGRAM_NAME => 'MYPGM', OBJECT_TYPE => '*PGM')) WHERE RESOLVED_SERVICE_PROGRAM_LIBRARY NOT IN ('QSYS', 'XYZ') ORDER BY PROGRAM_LIBRARY, PROGRAM_NAME; - List the programs or service programs that will be activated when MYLIB/MYPGM is activated.
Include information about each of those programs or service programs, such as their state,
activation group, storage model, and static storage
size.
SELECT PROGRAM_LIBRARY, PROGRAM_NAME, OBJECT_TYPE, PROGRAM_STATE, ACTIVATION_GROUP, STORAGE_MODEL, MINIMUM_STATIC_STORAGE_SIZE FROM (SELECT DISTINCT PROGRAM_LIBRARY AS ACTLIB, PROGRAM_NAME AS ACTNAME, OBJECT_TYPE AS ACTTYPE FROM TABLE(QSYS2.PROGRAM_RESOLVED_ACTIVATIONS( PROGRAM_LIBRARY => 'MYLIB', PROGRAM_NAME => 'MYPGM', OBJECT_TYPE => '*PGM')) ), TABLE(QSYS2.PROGRAM_INFO( PROGRAM_LIBRARY => ACTLIB, PROGRAM_NAME => ACTNAME, OBJECT_TYPE => ACTTYPE)) ORDER BY PROGRAM_LIBRARY, PROGRAM_NAME;

