Submitting commands from monitor programs
Monitor programs can call the COMMAND function to issue Db2 commands through the instrumentation facility interface. This capability is most useful for submitting commands to start, stop, display, and modify traces.
Using specified trace classes and IFCIDs, a monitor program can control the amount and type of its data. You can design your monitor program to:
- Activate and deactivate pre-defined trace classes.
- Activate and deactivate a trace record or group of records (identified by IFCIDs).
- Activate and deactivate predefined trace classes and trace records (identified by IFCIDs) restricting tracing to a set of identifiers, such as plan name, authorization ID, resource manager identifier (RMID), and so on.
The command is processed and the output messages are returned to the monitor program in the return area.
Asynchronous commands through IFI
You can execute commands asynchronously or synchronously. You can set a bit in the IFCA to specify how you want IFI to execute the commands. The following commands are affected:
- ALTER BUFFERPOOL
- SET LOG
- STOP DATABASE
- SET SYSPARM
Example Db2 command through IFI
This example issues a Db2 START
TRACE command for MONITOR class 1.
CALL DSNWLI,('COMMAND ',IFCAAREA,RETAREA,OUTAREA,BUFAREA),VL
⋮
COMMAND DC CL8 'COMMAND '
************************************************************************
* Function parameter declaration *
************************************************************************
* Storage of LENGTH(IFCA) and properly initialized *
************************************************************************
IFCAAREA DS 0CL180
⋮
************************************************************************
* Storage for length and returned info. *
************************************************************************
RETAREA DS CL608
************************************************************************
* Storage for length and Db2 Command *
************************************************************************
OUTAREA DS 0CL42
OUTLEN DC X'002A0000'
OUTCMD DC CL38'-STA TRAC(MON) DEST(OPX) BUFSIZE(1024)'
************************************************************************
* Storage of LENGTH(WBUF) and properly initialized *
************************************************************************
BUFAREA DS 0CL16
⋮