iCan Blog Archive

Integrated Language Environment (ILE) programs and service programs must be activated before they can be run; activation consists of allocating and initializing static storage for the program and runtime linking of programs to the service program exports that they reference. If you’ve programmed in ILE, you should be familiar with activation. Prior to IBM i 6.1 (and by default in 6.1), service programs were immediately activated during the call to a program that directly or indirectly used their services.

Activating an ILE program can be rather expensive, particularly as the number of referenced service programs increases. In the IBM i 6.1 release, an enhancement was made that allows for “activation on demand,” or as IBM documentation calls it, “deferred activation.” With deferred activation, the activation of a service program may be delayed until a procedure from the referenced service program is called.

By default, a program and all of its referenced service programs are activated prior to program execution. While this has the benefit of fast runtime performance when a service program’s services are used, the up-front activation overhead can be costly. This is particularly true when a number of those service programs aren’t typically used. Service programs that provide services for infrequently traveled paths of the application are good candidates for deferred activation. By deferring the activation of these service programs until they’re needed, you can reduce the up-front activation overhead. You’ll experience a slight performance impact the first time a service is needed from one of these service programs, as it’s activated on the fly, but that performance impact can be limited to only the infrequently used paths of the application.

How much, if any, up-front activation occurs for a service program bound for deferred activation depends on what imports it satisfies. No up-front activation occurs when the bound service program satisfies only procedure imports for static procedure calls and no procedure pointer calls. Minimal up-front activation occurs when the bound service program satisfies only procedure imports, but at least one is for a procedure pointer call. Further up-front activation occurs when the bound service program satisfies at least one data import but doesn’t require C++ static initialization. Full up-front activation only occurs when the bound service program satisfies at least one data import and C++ static initialization is required.

To enable deferred activation, there’s a new Activation keyword supported on the Bind Service Program parameter which can be *IMMED (the default) or *DEFER. This new parameter is available on the Create Program (CRTPGM), Create Service Program (CRTSRVPGM), Update Program (UPDPGM) and Update Service Program (UPDSRVPGM) commands.

IBM’s documentation on this subject is primarily in the ILE Concepts Guide in Chapter 2. The ILE Concepts link is also under Programming -> ILE Languages in the Knowledge Center navigation pane.

I’d like to thank Julie Rivers, Brian Hasselbeck and Scott Hanson for their assistance with this post. They were part of the team that developed the deferred activation support in 6.1.

This blog post was originally published on IBMSystemsMag.com and is reproduced here by permission of IBM Systems Media.