Using the Command Line Interface in z/OS
From OpsWise Documentation Wiki
Contents |
Overview
All OpsWise commands are supported in the z/OS environment. They are managed and executed by the program OPSCMDZ which may execute as either a command processor or a standard z/OS batch job. This program is installed with the z/OS agent.
z/OS-Specific Syntax Requirements
The commands and syntax requirements are the same for the z/OS environment, except the following:
Configuration File Parameters
If you use the OpsWise -c flag that specifies the configuration file, you must specify the file name using one of the following methods:
-c //DDN:ddname
where 'ddname' references a DD statement that exists in your batch JCL, OR
-c //DSN:dsname
where 'dsname' is a valid data set name which may be a partitioned data set with a member name}
Example:
// SET PRMS='ops-agent-status,-c //DDN:CMDOPTS,agent-type=windows'
Line Numbers in Configuration File
Do not place line numbers in columns 73-80.
Methods for Issuing OpsWise Commands in z/OS
Three methods are available for running OPSCMDZ and executing OpsWise commands:
- Using a batch job
- Under a TSO session
- Using a batch TSO Terminal Monitor Program (TMP)
Each of these methods is described below. In each example where data sets are specified, we use:
OPSWISE.LOAD -- location of the Opswise load modules USER.PARM - location of the command options UER.REXX - location of the user's REXX routines
Running OpsWise Commands in a Batch Job
You can run OPSCMDZ and a single OpsWise command as part of a JCL batch job step, but you can include additional commands in other steps. Shown below is an example followed by a description. The example shows how to issue a batch job requesting the status of all Windows agents.
//jobname JOB (acctg-info),'your name',MSGCLASS=X,MSGLEVEL=(1,1), // CLASS=A,NOTIFY=&SYSUID,TIME=5 //* // SET PRMS='ops-agent-status,-c //DDN:CMDOPTS,agent-type=windows' //* //STEP01 EXEC PGM=OPSCMDZ,PARM='&PRMS' //STEPLIB DD DISP=SHR,DSN=OPSWISE.LOAD //SYSPRINT DD SYSOUT=* //CMDOPTS DD DSN=USER.PARM(CMDOPTS),DISP=SHR //* //
- The SET statement sets a variable to a value containing the OpsWise command and its parameters. Example:
// SET PRMS='ops-agent-status,-c //ddn:clitxt,agent-type=windows'
Issuing Commands under TSO
You can also issue OpsWise commands under a TSO session. You must have TSOAUTH privileges.
TSOAUTH Privileges
Shown below is one example of how to grant TSOAUTH privileges to a user named USER01.
In an ISPF Command Prompt, issue the following RACF commands. (If you do not have permission to enter the commands, see your security administrator):
rdefine tsoauth testauth uacc(upd) permit testauth class(tsoauth) id(user01) acc(upd) setropts raclist(tsoauth) refresh
Adding OPSCMDZ to IKJTS000
Follow these steps to add OPSCMDZ:
- Add OPSCMDZ to both AUTHCMD and AUTHPGM in IKJTSO00.
- Make the IKJTSO00 change effective by issuing the following command:
/SET IKJTSO=00
Issuing OpsWise Commands in a TSO Session
The sample command string below shows an OpsWise command issued from an ISPF Command Shell prompt:
Enter TSO or Workstation commands below: ===> opscmdz ops-agent-status,-c //dsn:your-hi-level.clitxt,agent-type=windows
The above command will return data similar to the sample below:
Agentname AgentType Status fannyking8bfe - 2 Windows Active fannyking8bfe - HI-Taskbase Windows Offline opscmd-complete
Issuing Commands as a Batch TSO TMP
Two examples are provided below showing how to issue an OpsWise command in a batch TSO TMP.
Example One
//CMDZBAT JOB (acctg-info),'your name',MSGCLASS=X,MSGLEVEL=(1,1), // CLASS=A,NOTIFY=&SYSUID,TIME=5 //* //STEP01 EXEC PGM=IKJEFT01,DYNAMNBR=200,REGION=40M //STEPLIB DD DISP=SHR,DSN=OPSWISE.LOAD //SYSPRINT DD SYSOUT=* //SYSTSPRT DD SYSOUT=* //CMDOPTS DD DSN=USER.PARM(CMDOPTS),DISP=SHR //SYSTSIN DD * opscmdz ops-agent-status,-c //DDN:CMDOPTS,agent-type=windows //* //
Output will be in SYSTSPRT
Example Two
//REXXAGNT JOB (acctg-info),'your name',MSGCLASS=X,MSGLEVEL=(1,1),
// CLASS=A,NOTIFY=&SYSUID,TIME=5
//*
//STEP01 EXEC PGM=IKJEFT01,DYNAMNBR=200,REGION=40M
//STEPLIB DD DISP=SHR,DSN=OPSWISE.LOAD
//SYSEXEC DD DSN=USER.REXX,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//CMDOPTS DD DSN=USER.PARM(CMDOPTS),DISP=SHR
//SYSTSIN DD *
%OUTTRAP1
//*
/**************************** REXX *********************************/
/* SAMP02: Using OUTTRAP to */
/* (1) Obtain z/OS agent status */
/* (2) Test status from the command response */
/* (3) Launch a task if the agent status is Active */
/*******************************************************************/
x = OUTTRAP('OPS.')
opscmdz "ops-agent-status,-c //DSN:OPS01.QA.TXT(CLITXT),agent-type=z/OS"
SAY 'RC is:' RC
SAY OPS.0 'records were read.'
launch = 'NO'
DO i = 1 to OPS.0 WHILE launch = 'NO'
IF SUBSTR(OPS.i,61,6) = 'Active' THEN
DO
launch = 'YES'
opscmdz "ops-task-launch,-c //DSN:OPS01.QA.TXT(CLITXT),task-name=DUMPT"
END
END
DO i = 1 to OPS.0
SAY OPS.i
END
y = OUTTRAP('OFF')
/**************************** REXX *********************************/
