Sign in

docs ILE Concepts

Support for OPM and ILE APIs

Support for OPM and ILE APIs

Support for OPM and ILE APIs

When you develop new functions in ILE or convert an existing application to ILE, you may want to continue to support call-level APIs from OPM. This topic explains one technique that may be used to accomplish this dual support while maintaining your application in ILE.

ILE service programs provide a way for you to develop and deliver bindable APIs that may be accessed from all ILE languages. To provide the same functions to OPM programs, you need to consider the fact that a procedure in an ILE service program cannot be called directly from an OPM program.

The technique to use is to develop ILE program stubs for each bindable API that you plan to support. You may want to name the bindable APIs the same as the ILE program stubs, or you may choose different names. Each ILE program stub contains a static procedure call to the actual bindable API.

An example of this technique is shown in Figure 1.

Figure 1. Supporting OPM and ILE APIs

Supporting OPM and ILE APIs

Programs B through D are the ILE program stubs. Service program X contains the actual implementation of each bindable API. Each program stub and the service program are given the same activation group name. In this example, the activation group name VENDOR1 is chosen.

Activation group VENDOR1 is created by the system when necessary. The dynamic program call from OPM program A creates the activation group on the first call from an OPM program. The static procedure call from ILE program H creates the activation group when ILE program H is activated. Once the activation group exists, it may be used from either program A or program H.

Write the implementation of your API in an ILE procedure (procedure P1 in this example). This procedure can be called either directly through a procedure call or indirectly through a dynamic program call to the program stub. You must be careful when you take actions that are dependent on the call stack structure, such as sending exception messages. A normal return from either the program stub or the implementing procedure leaves the activation group in the job for later use. You can implement your API procedure with the knowledge that a control boundary is established for either the program stub or the implementing procedure on each call. HLL ending verbs delete the activation group whether the call originated from an OPM program or an ILE program.