Batch Report Filtering Examples

Batch Report Filtering Examples - control trace records processed by the Batch Report Writer.
caidb219
The section discusses how to control trace records that the Batch Report Writer processes.
Using IQL GLOBALS Statement
You can use the IQL GLOBALS statement to generate criteria that apply to all requests in a single Batch Report Writer job step. For example, use a GLOBALS statement when running a series of requests that only report on a particular plan. For this example, the name of the plan is SEAGOON. You can customize the first IQL report by adding the following statement to its beginning:
GLOBALS WHERE PLAN-NAME='SEAGOON'
All the requests that are specified in the Batch Report Writer job-step process as if they had been coded with WHERE PLAN-NAME='SEAGOON'. The effect of the GLOBALS statement is 
only
 applicable for that job step.
However sometimes it is more convenient to code the GLOBALS statement as a separate DD in the Batch Report Writer JCL. This flexibility lets you change the GLOBALS statement without having to change the IQL requests.
In the following example, DBGIN consists of three concatenated files: the GLOBALS statement and the two request members. To increase flexibility in changing the criteria for which input records are processed, the GLOBALS statement is specified inline in the JCL. The WHERE condition in the statement makes the Batch Report Writer process only the trace records that were produced on August 26, 2018 under the plan SEAGOON: 
//IDB2RWJ EXEC PGM=NSIGHTRW,REGION=4096K
//STEPLIB DD DISP=SHR,DSN=
idb2
.CDBALOAD
//DBGPRINT DD SYSOUT=*
//SYSPARMS DD DISP=SHR,DSN=
idb2
.SOURCE(IDRWPRMS)
//OBIDTBL DD DISP=SHR,DSN=
ssid
.OBID
//DB2DDN DD DISP=SHR,DSN=
ssid
.SMFALL
//DBGIN DD *
GLOBALS
WHERE PLAN-NAME='SEAGOON' AND
EVENT-TIME >= '180826000000' AND
<= '180826235959'
// DD DISP=SHR,DSN=
idb2
.CDBATREQ(BTSTASM1)
// DD DISP=SHR,DSN=
idb2
.CDBATREQ(BTSTASM2)
//BTSTASM1 DD SYSOUT=*
//BTSTASM2 DD SYSOUT=*
You 
cannot
 use the asterisk (*) and question mark (?) wildcard characters with the WHERE parameter in a GLOBALS statement or a request. Instead, use the substring facility (fieldname-expression).
For more information, see GLOBALS Statement. Other GLOBALS parameters control the number of records read, page size, line size, column spacing, and data set name prefix.
Using UNLOAD-FROM/TO System Parameters
If you run the Batch Report Writer using the data collector's online history STATS or ACCOUNTING file as an input directly, you can limit the amount of processed data using the following system parameters:
  • UNLOAD-FROM-DATE
     and 
    UNLOAD-FROM-TIME
     to define the beginning of a time range 
  • UNLOAD-TO-DATE
     and 
    UNLOAD-TO-TIME
     to define the end of a time range
As in the previous example, it is typically more convenient to code frequently changed UNLOAD parameters inline in a separate DD in the Batch Report Writer JCL while keeping the base system parameters in a separate file.
The following example combines a GLOBALS WHERE clause and UNLOAD parameters to demonstrate how to process a one hour range of ACCOUNTING history file data for the current day for the plan SEAGOON:
//IDB2RWJ EXEC PGM=NSIGHTRW,REGION=4096K
//STEPLIB DD DISP=SHR,DSN=
idb2
.CDBALOAD
//DBGPRINT DD SYSOUT=*
//DBGIN DD *
GLOBALS
WHERE PLAN-NAME='SEAGOON'
// DD DISP=SHR,DSN=
idb2
.CDBATREQ(BTACTSMS)
//BTACTSMS DD SYSOUT=*
//HISTACCT DD DISP=SHR,DSN=
idb2
.
ssid
.HSTACCTG
//SYSPARMS DD DISP=SHR,DSN=
idb2
.SOURCE(IDRWPRMS)
// DD *
UNLOAD-FROM-DATE='TODAY'
UNLOAD-FROM-TIME='10:00:00'
UNLOAD-TO-DATE='TODAY'
UNLOAD-TO-TIME='11:10:00'
/*
The concatenation of the base parameters file and the inline parameters JCL works only if the base parameters file does not end in the optional semicolon ';'.