After 25 years of using DB2 on midrange systems (AS/400, IBM i, etc), I’m now being tasked with being a database administrator for DB2 on the mainframe (z/OS). I apologize for the “rookie questions” here, but I’m still getting my head around the mainframe.
Currently, every morning, I manually check the status of several tablespaces using the DISPLAY command in the “DB2 Commands” screen:
e.g.
Cmd 1 ===> -DISPLAY DB(DN*) SPACENAM(*) USE LOCKS LIMIT(*)
Cmd 2 ===> -DISPLAY DB(DP*) SPACENAM(*) USE LOCKS LIMIT(*)
This displays several pages of output on the screen, pausing after each screen-full. If any tablespaces are in an invalid status, I can do something about it.
Ultimately, I’d like to issue several of these DISPLAY statements, directing the output to an output dataset. Then, I can either inspect that dataset manually or possibly write a program to parse the output dataset and report (or fix) any anomalies.
This is probably super easy for all you mainframe DB2 DBA’s, but how do I script these commands? Do I use REXX? If so, how?
Thanks for your help!
Dave
The easiest way would be to run the commands under the TSO terminal control program as a batch job.
This could look something like this (JOB-card omitted):
//*----------------------------------------------
//DISDB EXEC PGM=IKJEFT01,DYNAMNBR=20
//*----------------------------------------------
//STEPLIB DD DISP=SHR,DSN=DB2.DSNLOAD
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD DISP=SHR,DSN=YOUR.OUTPUT.DATASET
//SYSTSIN DD *
DSN SYSTEM(DBSYS)
-DISPLAY DB(DN*) SPACENAM(*) USE LOCKS LIMIT(*)
-DISPLAY DB(DP*) SPACENAM(*) USE LOCKS LIMIT(*)
//
The only thing is that SYSTSPRT
will contain a mix of your input-commands, the resulting output and a bit of other clutter but it is basically zero effort to implement.