Link to home
Start Free TrialLog in
Avatar of Member_2_2484401
Member_2_2484401Flag for United States of America

asked on

How do I script DB2 commands in z/OS?

Greetings, experts! 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!
DaveSlash
ASKER CERTIFIED SOLUTION
Avatar of Tomas Helgi Johannsson
Tomas Helgi Johannsson
Flag of Iceland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Member_2_2484401

ASKER

Thanks, Thomas! You're a talented man.

Can you please explain the last line to me? What is &&DBMLRP01?
Hi,

The &&DBMLRP01 in line 19 is a temporary dataset that is declared in line 2 and holds the output of the displays. :)
Exchange the temporary dataset to a physical dataset  or SYSOUT=* to see the output and/or work further with the data. :)

Regards,
     Tomas Helgi
Thank you, Tomas. The JCL is throwing an error that I'm unfamiliar with. Can you think of any reason why procedure XMITIP would not be found? (We're at DB2 verion 10 for z/OS.)

       7 //SYSTSIN  DD *                              
       8 //EMAIL  EXEC XMITIP                         
       9 //SYSPRINT DD SYSOUT=*                       
      10 //SYSTSPRT DD SYSOUT=*                       
      11 //SYSTSIN  DD *                              
      12 //DATAB   DD DSN=&&DBMLRP01,DISP=(OLD,DELETE)
         /*                                           
STMT NO. MESSAGE                                      
       8 IEFC612I PROCEDURE XMITIP WAS NOT FOUND      

Open in new window


Thanks!
Dave
Hi Dave,

XMITIP is not part of DB2.
XMITIP is a mainframe SMTP application that my shop has installed to send emails from our mainframe. :)
http://www.lbdsoftware.com/XMITIP-Guide.pdf (you can also use google to search for XMITIP :) )

Regards,
    Tomas