Invoking IFI from a monitor program

You can issue calls to IFI functions from a program or function outside of Db2 to submit commands, obtain trace data, and pass data to Db2 through IFI.

Procedure

Begin program-specific programming interface information. To invoke IFI from a program:

  1. Include a call to DSNWLI in your monitor program.
    You can invoke IFI from assembler and PL/I programs.
    The following example depicts an IFI call in an assembler program. All IFI-related examples are given for assembler.
    CALL DSNWLI,(function,ifca,parm-1,...parm-n),VL
    The parameters that are passed on the call indicate the function, point to communication areas used by the function, and provide other information that depends on the function specified. Because the parameter list might vary in length, the high-order bit of the last parameter must be on to signal that it is the last parameter in the list. For example, VL option signals a variable length parameter list and turns on the bit in assembler.
  2. Link-edit the program with the correct language interface.

    The DSNULI language interface module can be linked with 31-bit RRS, CAF, TSO, and CICS® applications. DSNULI cannot be linked with 24-bit application programs. Each of the following language interface modules also has an entry point of DSNWLI for IFI:

    • CAF DSNALI
    • TSO DSNELI
    • CICS DSNCLI
    • IMS DFSLI000
    • RRSAF DSNRLI

    CAF DSNALI, the CAF (call attachment facility) language interface module, includes a second entry point of DSNWLI2. The monitor program that link-edits DSNALI with the program can make IFI calls directly to DSNWLI. The monitor program that loads DSNALI must also load DSNWLI2 and remember its address. When the monitor program calls DSNWLI, the program must have a dummy entry point to handle the call to DSNWLI and then call the real DSNWLI2 routine.

What to do next

A monitor program has the following requirements:
Connection
A monitor program that issues IFI requests must be connected to Db2 at the thread level. If the program contains SQL statements, you must precompile the program and create a Db2 plan using the BIND process. If the monitor program does not contain any SQL statements, it does not have to be precompiled. However, as is the case in all the attachment environments, even though an IFI only program (one with no SQL statements) does not have a plan of its own, it can use any plan to get the thread level connection to Db2
Bit mode
The monitor program can run in either 24- or 31-bit mode.
Authorization
On the first READA or READS call from a user, an authorization is checked to determine if the primary authorization ID or one of the secondary authorization IDs of the plan executor has MONITOR1 or MONITOR2 privilege. If your installation uses the access control authorization exit routine, that exit routine might control the privileges that can use the monitor trace. If you have an authorization failure, an audit trace (class 1) record is generated that contains the return and reason codes from the exit. This is included in IFCID 0140.End program-specific programming interface information.
.