Example - Wait a Specified Time Interval
This article describes how to use READA to wait a specified time interval.
One way to use READA is to set a timer and have your exec wake up after a specified interval. The following example runs five times, waking up every 15 seconds to obtain trace data collected by Db2 during the previous 15-second interval. Each time the exec resumes execution, it issues a READA request to obtain the accumulated trace data. This exec, named RIFSAMP2, can be found in the CRAIEXEC library.
/* REXX */ address IFISignal on error name Terminate(1)Signal on syntax name Terminate(2)dsn = '' /* Specify Db2 subsystem name */ plan = '' /* Specify RLX plan name */ wbufsize = 8 /* size of the trace buffer */ wbuffmt = 'DEFAULT' /* map all ifcids */ "caf activate thread(:t1) system(:dsn) plan(:plan)"(2)if rc <> 0 then return "-start trace (perfm) class(30) IFCID(65)",(3)"dest(opx) bufsize("wbufsize")" if ifcarc1 > 0 then return do 1 x = wait( SEC ,15)(4)"READA"(5)say 'READA completed, IFCA RC1='ifcarc1 'RC2='ifcarc2 if ifcabm > 0 then(6)call Display_trace else say 'No data received' end Terminate : "-stop trace(perfm) tno("ifcatnor")"(7)"caf remove thread(:t1)"(8)return Display_trace : Say '>>>Total number of IFCIDs received' ifc.0 do i = 1 to ifc.0(9)Say ' ' Say '>>>Record' i 'IFCID =' ifcid.i Say Product_headers() if ifcid.i <> 65 then iterate(10)do j = 1 to ifc.i.0(11)do k = 1 to ifc.i.j.0(12)call Display_ifcid0065 end end end Return Display_ifcid0065 :(13)Say 'Location name =' QW0065LN.i.j.k Say 'Package Collection =' QW0065PC.i.j.k Say 'Program name =' QW0065PN.i.j.k Say 'Time stamp =' QW0065TS.i.j.k Say 'Statement Number =' QW0065SN.i.j.k Say 'Statement Type =' QW0065ST.i.j.k Say 'Cursor name =' QW0065CL.i.j.k Return Product_headers :(14)headers = '>>> Products headers:' if qwhs.i.0 > 0 then headers = headers 'QWHS=YES' if qwhc.i.0 > 0 then headers = headers 'QWHC=YES' if qwhu.i.0 > 0 then headers = headers 'QWHU=YES' if qwhd.i.0 > 0 then headers = headers 'QWHD=YES' if qwht.i.0 > 0 then headers = headers 'QWHT=YES' Return headers(15)
Notes:
(1)
(2)
(3)
(4)
(5)
RLX
/Software Development Kit puts the exec in a wait state for 15 seconds.(6)
(7)
(8)
(9)
(10)
i
in the returned buffer, up to the maximum of records stored in the counter IFC.0.(11)
(12)
j
in the IFCID record i,
up to the maximum number of data records stored in the counter IFC.i.0.(13)
k
of the data section j
of the IFCID record i,
display the data section occurrences. In the case of IFCID 0065, there is always one data section which occurs only once. But for some other IFCIDs -- such as 0124, 0148, 0058, and others -- there are multiple data sections which may occur many times. This section of REXX code can handle any of the complex IFCID maps.
(14)
(15