Resolving API calls from z/OS® clients dynamically

Instead of link-editing the Operational Decision Manager API stub program with your object code, you can dynamically call the stub from within your program. This can increase the portability of your program as you are able to use the same program in batch, IMS, and CICS® environments without link-editing the program again.

Before you begin

Some considerations must be made when you choose to call the API stub dynamically. For instance, dynamically calling the stubs might have the following impacts:
  • Potentially increases the complexity of your programs
  • Increase the storage that is required by your programs at execution time
  • Reduce the performance of your programs

If the portability of the program outweighs the preceding limitations, then the API stubs can be dynamically called by using the COBOL and PL/I examples.

Procedure

To dynamically call the API stubs, use one of the following examples:
  • Dynamic linking by using COBOL in the batch environment:
    ...
    WORKING-STORAGE SECTION.
    ...
    05 WS-HBRCONN           PIC X(7) VALUE 'HBRCONN'.
    ...
    PROCEDURE DIVISION.
    ...
    CALL WS-HBRCONN USING HBRA-CONN-AREA.
  • If the compile option DYNAM is specified, then you can code the Operational Decision Manager API as a CALL literal and you still get dynamic behavior:
    ...
    CALL 'HBRCONN' USING HBRA-CONN-AREA.
    
  • Dynamic linking by using PL/I in the batch environment:
    In the HBRWSP copy book, modify the declarations of the API calls as follows. From:
    dcl HBRCONN ext entry (pointer) OPTIONS (byvalue);
    To:
    dcl HBRCONN ext entry OPTIONS (assembler inter);

    Then, call as follows:

    FETCH HBRCONN;
    
    CALL HBRCONN (HBRA_CONN_AREA);
    
    RELEASE HBRCONN;
You must ensure that your execution environment is correctly configured and is pointing to the right load library.
Table 1. Execution environment and load libraries
Environment DDNAME Operational Decision Manager PDS
Batch STEPLIB ++HBRHLQ++.SHBRLOAD
CICS DFHRPL ++HBRHLQ++.SHBRCICS
IMS STEPLIB ++HBRHLQ++.SHBRIMS

++HBRHLQ++.SHBRLOAD

For more information about COBOL STATIC versus DYNAMIC calls, see Making static calls External link opens a new window or tab and Making dynamic calls External link opens a new window or tab.