Requesting data synchronously from a monitor program

READS allows your monitor program to read Db2 status information that is collected at the time of the IFI call.

About this task

For a list of trace fields that can be returned by READS requests, see Trace fields for READS requests.

Because of performance considerations, the majority of data that is obtained by a monitor program probably comes over the synchronous interface. Summarized information is easier for a monitor program to process, and the monitor program logic is simpler because a smaller number of records are processed.

Procedure

For monitor programs that collect synchronous data, use the following approaches:

  • Consider reasonability tests for data that is obtained through READS.
    The READS request can reference data that is updated during the retrieval process. Because the READS function does not usually suspend activity that takes place under referenced structures, an abend can occur. If an abend occurs, the READS function is terminated without a dump and the monitor program is notified through the return code and reason code information in the IFCA. However, the return area can contain valid trace records, even if an abend occurred; therefore, your monitor program should check for a non-zero value in the IFCABM (bytes moved) field of the IFCA.
  • When you use a READS request with a query parallelism task, remember that each parallel task is a separate thread.
    Each parallel thread has a separate READS output.
  • Use the qual-area parameter, mapped by DSNDWQAL, to qualify the trace records to be returned on IFI READS requests.
  • Display the synchronous trace data on a terminal by creating a monitor program that uses the following logic:
    1. Initialize.
    2. Set a timer.
    3. Wait for the timer to expire.
    4. Call IFI to obtain statistics data via a READS request.
    5. Do delta calculations to determine activity. This step is not necessary for IFCID 0199 because the statistics are reset statistics at the beginning of every collection interval.
    6. Display the information on a terminal.
    7. Loop back to the timer.
    End program-specific programming interface information.