Automatic Unload of Detector Datastore
search cancel

Automatic Unload of Detector Datastore

book

Article ID: 54719

calendar_today

Updated On:

Products

Detector for DB2 for z/OS

Issue/Introduction

Is there a way to schedule a job, with fixed parameters, to unload the data from the Detector for Db2 for z/OS (PDT) datastore for the previous day,
regardless of the number of intervals, and avoid unloading duplicate data?

Resolution

The process can be accomplished in two steps or jobs:

Job 1 gets triggered by the appearance of the PDT0170 message in the system log. This is an information message that is written to indicate the end of an interval.
You will need an automation tool like OPS/MVS to create a rule to submit this job each time the PDT0170 message appears in the system log.

This is the PDTBATCH job with DATATYPE=ALL and INTERVALS=1
And the SYSREC DD should have a DISP=MOD,DSN=xxxxxxxx.SYSRECAC
The output from each interval will be accumulated in the xxxxxxxx.SYSRECAC file
Job 1 will be submitted for however many intervals there are in a day.

Here is the sample JCL:

JOB1 
//STEP1    EXEC PGM=PTLDRIVM,PARM='EP=PDTBATCC/0000',   
//             REGION=0M
//* 
//*        Get one intervals worth of data and add to the end of SYSREC01
//*
//STEPLIB  DD  DISP=SHR,DSN=xxxxxxxx.LOADLIB
//PTILIB   DD  DISP=SHR,DSN=xxxxxxxx.LOADLIB
//PTIPARM  DD  DISP=SHR,DSN=xxxxxxxx.PARMLIB
//SYSPRINT DD  SYSOUT=*
//SYSOUT   DD  SYSOUT=*
//SYSREC   DD  DSN=XXXXXXX.SYSRECAC,DISP=MOD
//*
//PPAEXPL  DD  SYSOUT=*
//*
//SYSIN    DD  *
 SSID=XXXX
 DATASTORE=XXXXXXXX
 VCAT=XXXXXXXXXXX
 INTERVALS=1
 DATATYPE=ALL


Job 2 - This is scheduled and runs once a day.
This is an IEBGENER which copies from xxxxxxxx.SYSRECAC to xxxxxxxx.SYSRECDL

Now SYSRECDL has the full days worth of data, with no duplicates.
The second step of Job 2 would be to reset the xxxxxxxx.SYSRECAC dataset to empty (via in IEFBR14 reallocation or IEBGENER from an empty DSN)

Here is the sample JCL:

JOB 2
//*        At the end of the day copy one day?s data from SYSRECAC into SYSREC daily file
//*        SYSRECDL (possibly this could be a generation data set)
//*
//ASMIT    EXEC PGM=IEBGENER
//SYSPRINT DD   SYSOUT=*
//SYSUT1   DD DSN=xxxxxxxx.SYSRECAC,DISP=SHR
//SYSUT2   DD DSN=xxxxxxxx.SYSRECDL,DISP=SHR
//SYSIN    DD DUMMY 
//*
//*        following a successful copy, reallocate the daily accumulate file SYSRECAC
//*                                
//DELETE   EXEC PGM=IEFBR14, COND=(4,LT)
//SYSREC   DD  DSN=XXXXXXX.SYSRECAC,
//         DISP=(MOD,DELETE),SPACE=(CYL,1),UNIT=SYSDA   
//*

NOTE: You can check that the DISP=MOD works for the PDTBATCH by running the same batch job twice with DISP=MOD.
After the second run the file size should be as large as after the first run.