Execute DB2 commands in JCL - Health Check

I used to wonder, what if a DB2 object of which you are a DBA is in a restricted status and its time for the the daily batch flow to be released on the CA7 ? Well you will end up getting a page/event if you are oncall. I seriously wouldn't want to break my goodnight sleep and wake up for an action that could have been avoided, and I am sure you would not like it to. You would eventually fix it, but hey the damage is done on that job which abended with a return code <> 0


So here is a simple health check JCL that can be installed in your shop, may be simplest of all which would perform the check and would notify you well prior to the startup task/production job flow. I am most certain sure that this is installed in your shops, but the excitement of simplicity of this job makes the difference.

Here is your JCL :

//*Your standard JOB card goes here
//HEALTH  EXEC PGM=IKJEFT01
//*Change STEPLIB as per your account
//STEPLIB    DD DISP=SHR,DSN=SHOP.PRDN.DSNEXIT
//                 DD DISP=SHR,DSN=SHOP.PRDN.DSNLOAD
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD DSN=HLQ.HEALTH.CHECK,
//                        DISP=(MOD,CATLG,DELETE),
//                        SPACE=(CYL,(1,1),RLSE)
//SYSTSIN     DD *
DSN SYSTEM(PRDN)
-DISPLAY DATABASE(*) SPACE(*) RESTRICT
-DISPLAY DATABASE(*) SPACE(*) ADV
//SYSIN          DD DUMMY
//*Mail step goes here

-DISPLAY DATABASE(*) SPACE(*) RESTRICT

This command would populate all the objects that were in the restricted status such as COPY pending, RBLD pending etc.

-DISPLAY DATABASE(*) SPACE(*) ADV

This command would populate all the objects that were in a advisory state such as AERO* etc.


Summary:

How easy was it ? I have included all the databases as an example in the display command, it is your choice if you have a selected set of objects in mind. If you are good with REXX programming then you can optimize your JCL to send you emails only when there is a problem. All you now have to do is schedule this JCL in your environment prior and post the daily/weekly/monthly/quarterly/yearly batch cycle depending on your needs and it will proactively notify you of your DB2 object status.

No comments:

Post a Comment