You can create a monitor program that requests an asynchronous
buffer, which records trace data as trace events occur. Monitor programs
can call the READA function to read data asynchronously from an OPn buffer.
About this task
Db2 can
buffer all IFCID data that is activated by the START TRACE command
and pass it to a monitor program on a READA request. The IFCID events
include the following types of information:
- Serviceability
- Statistics
- Accounting
- Performance
- Audit data
- IFCIDs defined for the IFI write function
Procedure
To create a monitor program that requests asynchronous
data, use the following approaches:
- Issue a START TRACE command from the monitor program and specify a buffer location to start the collection of asynchronous data.
FL 504
You can specify a generic value or specific online performance monitor destinations, OPn, where n is any integer in the range 1–16.
After the trace is started, Db2 collects and buffers the information as it occurs.
- Specify the generic OPX option in the initial START TRACE
command to avoid conflicts with other traces or programs.
When OPX is specified, the instrumentation facility assigns
the next available buffer destination slot and returns the OPn destination
name to the monitor program. The program can use subsequent START
TRACE or MODIFY TRACE commands to direct the data to the destination
specified by the instrumentation facility.
- Issue READA requests to move the buffered data to the monitor
program.
- Use specific initial OPn destinations
in the following situations:
- When you plan to start numerous asynchronous traces to the same
OPn destination. To do this, you must specify the
OPn destination in your monitor program. The OPn destination
that is started is returned in the IFCA.
- When the monitor program specifies a particular monitor class
(defined as available) together with a particular destination (for
example OP7) to indicate that certain IFCIDs are started. An operator
can use the DISPLAY TRACE command to determine which monitors are
active and what events are being traced.
- Configure the monitor program to use large buffers and
specify small WBUFBC values to prevent data loss.
Data
loss occurs when the buffer fills before the monitor program can obtain
the data. Db2 does not wait
for the buffer to be emptied. Instead, it informs the monitor program
on the next READA request (in the IFCARLC field of the IFCA) that
the data was lost.
-
Display the asynchronous data on a terminal by creating a program
that uses the following logic:
- Initialize.
- Use GETMAIN to obtain a storage area equal to the BUFSIZE
value in the START TRACE command.
- Issue the following command through IFI to wake up this
routine by a POST whenever the buffer is 20% full:
START TRACE=ACCTG DEST=OPX
- Check the status in the IFCA to determine if the command
request was successful.
- WAIT for the buffer to be posted.
- Clear the post flag.
- Issue a READA request to obtain the buffer data.
- Check the status of the READA request.
- De-block in the information.
- Display the information on the terminal.
- Loop back to the WAIT.
![End program-specific programming interface information.](../cmn/../art/pspi_cls.svg)