Collecting data by using the batch JCL

This topic shows an example of a batch job that performs a so-called Collect Report Data task.

About this task

The meaning of the parameters in the batch job is identical to those described in Configuring a collect task. Regarding the parameter syntax, note that keywords are succeeded by values in parentheses (), comment lines start with an asterisk (*), and blanks are allowed between keywords and values.

Note that you can use and modify the JCL sample provided in data set member prefix.TKO2SAMP(BPOMACRD). It is usually more current than the example in this information.

If you want to compress collected data into a separate data set, equivalent to the Collect Report Data (CRD) function, use a batch job similar to that shown in The TRSMAIN terse utility.

You must assign a job class with a high priority to data collection batch jobs. This priority must be at least as high as that of Db2®. Otherwise, trace records are not collected fast enough, resulting in lost records, or the trace might be started and stopped immediately after the catalog data is collected.

When the BPA CRD program is started from the APF-authorized steplib, it attempts to establish itself as an independent enclave that has a Workload Manager (WLM) subsystem type of Db2. It is possible that your WLM policy causes the generic WLM subsystem type of Db2 to get low dispatching priority. In this case, you can start the BPA CRD job from the non-APF copy of RKANMOD data set so the collection process will use the dispatching priority of the batch job.

Example:
//*******************************************************************//
//*                                                                 *//
//*   MODULE NAME : BPOMACRD                                        *//
//*                                                                 *//
//*   DESCRIPTION : DB2 BPA Collect Report Data Batch Job           *//
//*                                                                 *//
//*   COPYRIGHT   : IBM DB2 Buffer Pool Analyzer for z/OS  V5R4M0   *//
//*                 Licensed Materials - Property of IBM            *//
//*                 5655-W35 (C) Copyright IBM Corp. 2001, 2016     *//
//*                                                                 *//
//*   STATUS      : Version 5.4.0                                   *//
//*                                                                 *//
//*   FUNCTION    : Collect Report Data in Batch Mode               *//
//*                                                                 *//
//*                                                                 *//
//*   Notes =                                                       *//
//*     1.  Add a valid job card                                    *//
//*     2.  Change the prefix of the DB2 BPA load library db2bpa    *//
//*     3.  Change the prefix of the DB2 load library db2load       *//
//*     4.  Change the DPCOLLDD DD statement for the trace data     *//
//*     5.  Change the collect parameters in the SYSIN data set     *//
//*                                                                 *//
//*End of Specifications*********************************************//
//*
//DB2BPA  EXEC PGM=DB2BPCRD
//STEPLIB  DD  DSN=db2bpa.SDSNLOAD,DISP=SHR
//         DD  DSN=db2load.RKANMOD,DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSOUT   DD  SYSOUT=*
//* Protocol of the CRD parameters and status information
//DPMLOG   DD  SYSOUT=*
//* Report of the data collection job
//JOBSUMDD DD  SYSOUT=*
//*PCOLLDD DD  DISP=OLD,DSN=your.db2trace.dsname
//DPCOLLDD DD  DISP=(NEW,CATLG),DSN=your.db2trace.dsname,
//             DCB=(RECFM=VBS,BLKSIZE=9076,LRECL=32756),
//             SPACE=(TRK,(500,100)),VOL=SER=xxxxxx,UNIT=3390
//SYSIN    DD  *
* Mandatory parameters
  DB2SSID       (ssid)       * DB2 subsystem id
  PLANNAME      (planname)   * DB2 BPA planname
* Optional parameters, for fixed values enter either the characters
* specified in capital letters or the full word
  RECORD_FORMAT (short)      * STandard or SHort(default)
  DATATYPE      (detail)     * DEtail(default), SUmmary, or CAtalog
  STARTTIME     (im)         * IMmediately(default) or hh:mm:ss,
                             * where hh:mm:ss gives the time within the
                             * next 24 hours when the trace is to start
* Instead of specifying a start time you can use your batch scheduling
  DURATION      (nnnu)       * Maximum job duration, where nnn specifies
                             * time units and u = s for seconds
                             *                    m for minutes or
                             *                    h for hours
                             * Default is 30m.
  MAX_RECORDS   (rrrrr)      * Maximum number of records to be
                             * collected, optionally in K (=1000)
                             * or M (= 1000000). An example is 25000 which
                             * is the same as 25K.
  SAMPLING      (mmm,sss)    * Indicates that tracing is done in
                             * sampling mode. mmm denotes the
                             * time interval between 2 collection
                             * periods in minutes. sss denotes
                             * the time in seconds when DB2 trace is
                             * active during a sampling interval.
                             * If SAMPLING is omitted (default), DB2
                             * trace data are collected continuously.
  BUFSIZE       (nnnn)       * Specifies the op buffer size in the
                             * DB2 Start Trace command. nnnn indicates
                             * the number of KB and ranges from 8 to
                             * 65536, default is 2048 for 2048 KB.
  TRIGGER      (nn)         * Specifies the threshold at which DB2 posts  
                             * the monitoring program to read from the OP
                             * buffer. nn ranges from 1 to 99 indicating
                             * the fill percentage of the OP buffer.
                             * The default setting is 20.
The batch job generates the following files:
DPCOLLDD
Contains the trace data.
DPMLOG
Contains information about the parameter stream.
JOBSUMDD
Contains a protocol about the process and trace messages from Buffer Pool Analyzer and Db2. The messages are identical to those shown in the Trace Messages panel, which is described in Interpreting trace status summary and trace messages.