Wait for a Specified Amount of Data to Accumulate

Describes how to wait for an amount of data to accumulate.
Your monitor execs can also wait to be posted by Db2 when sufficient data accumulates. In this method, you specify the address of an ECB that Db2 should post once it has collected a specified number of bytes of trace data. Once posted, your exec can issue a READA request to have
RLX
/IFI obtain the accumulated data and map it into REXX variables.
The following example waits until Db2 collects 7 KB of trace data. Each time the exec resumes execution, it issues a READA request to obtain the accumulated trace data.
/* REXX */ address IFI
(1)
wbufecb = GETMAIN(4)
(2)
wbufsize = 8
(3)
wbufbc = 7
(4)
dsn = '' /* Specify Db2 subsystem name */ plan = '' /* Specify RLX plan name */ "caf activate thread(:t1) system(:dsn) plan(:plan)"
(5)
"start trace (perfm) class(30) IFCID(65) dest(opx)",
(6)
"bufsize("wbufsize")" Do 5 post_code = wait(‘ECB’,wbufecb)
(7)
‘READA’
(8)
/* process returned buffer */
(9)
End "-stop trace(perfm) tno("ifcatnor")"
(10)
"caf remove thread(:t1)"
(11)
Return
Notes:
(1)
Establish IFI as the default REXX host command environment
(2)
Obtain 4 bytes for an ECB via the GETMAIN service of the
RLX
/Software Development Kit. The GETMAIN function returns a 31-bit address of the storage that is just obtained into variable WBUFECB
.
(3)
The BUFSIZE variable specifies the size of the trace buffer, in kilobytes, which Db2 allocates for the OPx destination.
(4)
The BUFBC variable specifies the amount of trace data, 7K bytes, that once accumulated, causes Db2 to post WBUFECB. This allows the REXX exec to continue execution with a READA command
.
(5)
Connect to the Db2 subsystem whose name is the REXX variable DSN. Open a monitor application plan whose name is in the REXX variable PLAN.
(6)
Issue a -START TRACE command to create and claim ownership of a Db2 trace buffer of the size that is specified by WBUFSIZE.
(7)
Wait for Db2 to post the ECB addressed by WBUFECB
(8)
The READA command obtains the accumulated trace data and maps it into REXX variables.
(9)
Your REXX statements go here to process IFCID data
(10)
Stop Db2 trace started in (6)
(11)
Remove the monitor thread