These REXX statements produce output similar to the output in the following example:
say 'Count of address spaces:' OPSTATUS('A','I','*')
do while queued() > 0
pull x
say x
end
Output:
Count of address spaces: 12 *MASTER* NONE NONE 0001 NSW SYS ....(more columns here)... PCAUTH PCAUTH NONE 0002 NSW SYS .......................... TRACE TRACE NONE 0003 NSW SYS .......................... GRS GRS NONE 0004 NSW SYS .......................... DUMPSRV DUMPSRV DUMPSRV 0005 OWT SYS .......................... CONSOLE CONSOLE NONE 0006 NSW SYS .......................... ALLOCAS ALLOCAS NONE 0006 NSW SYS .......................... SMF SMF IEFPROC 0007 NSW SYS .......................... ACF2 ACF2 IEFPROC 0008 NSW STC .......................... NIT STEP2 NONE 0011 OWT INI .......................... BATJOB1 STEP2 NONE 0012 NSW JOB .......................... TSOID1 NONE NONE 0009 OWT TSU ..........................
Examples: OPSTATUS
Reviewing the following examples gives you a better understanding of OPSTATUS:
jobname = "CICSPROD"
status = OPSTATUS("A","A",jobname)
if status=1 then TASKSTAT = "UP"
userid = "TSOUSER" /* Replace TSOUSER with a valid TSO user ID */
if OPSTATUS("T","A",userid) <> 1 then
say userid "is not logged on at this time."
say "Count of Outstanding Replies" OPSTATUS("R","I","*")
do while QUEUED() > 0 pull line say line end
ThisSys = OPSINFO("SYSNAME")
temp = OPSTATUS("R","S","*")
do while QUEUED() > 0
parse pull ReplyID Text
parse pull jbnm jbid asid syna uid secs .
if (syna = ThisSys) & (secs > 300) then
say jbnm jbid asid uid secs ReplyID Text
end
The creation of threshold automation is common logic that eliminates the issuing of duplicate actions when the same triggering event occurs many times within a defined time interval. This function lets you easily create criteria threshold automation logic within your AOF rules which can fire numerous times within a specific time interval. For example, threshold automation could cause a particular type of automation to take place if an event occurs x times in y minutes.
Use the OPSTHRSH() function within AOF rules, specifically MSG, API, and USS events.
No additional installation steps or parameters are needed to utilize this function.
somevarname = OPSTHRSH(type,interval in seconds,criteria entity,criteria startingpos)
Refer to the Sample Coding Statements for the specific syntax details of each of these listed functions and keywords.
|
Type |
Function Description |
|---|---|
|
E |
Checks the threshold against the event that triggered the rule. For a )MSG ABC123 rule, an ‘E’ threshold type would be against ‘all’ ABC123 events. |
The function returns the number of times (or count) that the specified threshold type has occurred within an interval defined in number of seconds. The count is reset to 1 after a specified time interval has passed since the issuance of the last threshold event. For example, if you have cnt = OPSTHRSH(‘E’,’600’) in a )MSG ABC123 rule and ABC123 issues 10 times within a second (cnt =10), and then again 30 minutes later, cnt is reset to 1 because you are beyond the specified time interval.
The following sample AOF rule restarts the SMSVSAM address space if it abends with an X’0F4’ abend. The OPSTHRSH function is used to restart SMSVSAM only once in a 10-minute period:
)MSG IEA989I
)Init
/*--------------------------------------------------------------------*/
/* Set maxcnt variable to the value that indicates on which occurrence*/
/* of the event in a specified interval the rule will do the desired */
/* automation. */
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7*/
maxcnt = 1
)Proc
/*--------------------------------------------------------------------*/
/* Parse message to obtain abend id and jobname variables. */
/* */
/* IEA989I SLIP TRAP ID=X0F4 MATCHED. JOBNAME=SMSVSAM */
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7*/
parse var msg.text . 'ID=' abend . 'JOBNAME=' jobname
/*--------------------------------------------------------------------*/
/* Get out if not an 0F4 abend AND not for the SMSVSAM address space. */
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7*/
if abend <> 'X0F4' & jobname <> 'SMSVSAM' then return
/*--------------------------------------------------------------------*/
/* Call the OPSTHRSH function that returns how many times the event */
/* has occurred in the specified interval (10 mins). */
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7*/
cnt = OPSTHRSH('E' ,'600' )
/*--------------------------------------------------------------------*/
/* If this is the desired occurrence (maxcnt) then issue the FORCE */
/* SMS command to restart SMSVSAM asid. */
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7*/
if cnt = maxcnt then
do
address OPER
"Command(FORCE SMSVSAM,ARM) Nooutput"
end
return
Incorporate a ‘SIGNAL on SYNTAX’ routine into the rule or program to obtain and display any error messages that are returned during a function call failure. Additionally, use a ‘TRACE I’ REXX statement when it is needed before the function call to obtain the logical trace activity within the invoking rule or program. The debugging code has a format similar to the following example:
/*--------------------------------------------------------------------*
/* Create Signal on Syntax routine to obtain any failure messages. *
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7*
signal on syntax
/*--------------------------------------------------------------------*
/* Add TRACE I if needed to trace logic flow of rule. *
/*--+----1----+----2----+----3----+----4----+----5----+----6----+----7*
trace I
cnt = OPSTHRSH('E' ,'600' )
if cnt = maxcnt then
do
address OPER
"Command(FORCE SMSVSAM,ARM) Nooutput"
end
return
syntax:
do queued()
pull err_info
say 'Failure info from OPSTHRSH='err_info
end
You can also obtain traces using a local OPSLOG (AOF TEST facility) and the following enhanced rule example:
)MSG IEA989I
)PROC
CNT = OPSTHRSH('E' ,'600' )
SAY 'FIRE COUNT = 'CNT 'ID='MSG.ID
IF CNT = 1 THEN DO
SAY '*** DO AUTOMATION ***'
ADDRESS OPER
"COMMAND(FORCE SMSVSAM,ARM) NOOUTPUT"
END
RETURN
You then see the following screen in the AOF TEST facility:
AOF Test MSG ------------ CA11 --- OPSVIEW --- 08:17:16 19AUG2014 COLS 001 041 Command ===> Scroll ===> CSR REXX Trace ==> N Live Commands ==> NO Access Auto Test Data ==> (Y/N) Msg Id: IEA989I Msg Disp: Normal Hardcopy Log: Yes Jobname ==> SMSVSAM IMS Id ==> Job Id ==> Exit Type ==> MVS MSF Sys ==> Console Id ==> 1 User ==> Console Nm ==> Sys Id ==> MCS Flags ==> 000000 Special Ch ==> Descriptor ==> 0000 Route ==> 00000000000000000000000000000000 Term Name ==> Report Id ==> Message ==> IEA989I Message text Time Job Name Message ID ASID Dis ----+----1----+----2----+----3----+----4- ******** ******** ********** **** *** TOP OF MESSAGES *********************** 08:17:16 USERID1 TEST.IEF45 02E0 NON ENABLE TEST.IEF450I 08:17:16 USERID1 TEST.IEF45 02E0 NON ENABLE TEST.IEF450I 08:17:16 USERID1 NONE 02E0 000 OPU3900O RULE TEST.IEF450I FOR MSG IEA98 08:17:23 SMSVSAM IEA989I 02E0 NOR IEA989I Message text 08:17:23 USERID1 NONE 02E0 000 OPU1000I FIRE COUNT = 1 ID=IEA989I 08:17:23 USERID1 NONE 02E0 000 OPU1000I *** DO AUTOMATION *** 08:17:23 USERID1 NONE 02E0 000 OPU4200I OPER: 'COMMAND(FORCE SMSVSAM,ARM 08:17:23 SMSVSAM IEA989I 02E0 NOR IEA989I Message text 08:17:28 SMSVSAM IEA989I 02E0 NOR IEA989I Message text 08:17:28 USERID1 NONE 02E0 000 OPU1000I FIRE COUNT = 2 ID=IEA989I 08:17:28 SMSVSAM IEA989I 02E0 NOR IEA989I Message text 08:17:30 SMSVSAM IEA989I 02E0 NOR IEA989I Message text 08:17:30 USERID1 NONE 02E0 000 OPU1000I FIRE COUNT = 3 ID=IEA989I 08:17:30 SMSVSAM IEA989I 02E0 NOR IEA989I Message text ******** ******** ********** **** *** BOTTOM OF MESSAGES *********************
You can also use the OPSLOG to obtain these traces but if the OPSTHRSH function fails or gives unexpected output, this may harm your automation. In such a case, modify the rule appropriately. For example, use the SAY command instead of the following command:
ADDRESS OPER "COMMAND(FORCE SMSVSAM,ARM) NOOUTPUT".
The OPSTHRSH function returns the number of occurrences of the event in the rule environment.
If the function is invoked from an OPS/REXX program, it fails immediately and generates the following return code:
|
Return Code |
Reason Code |
Description |
|---|---|---|
|
40 |
none |
Incorrect call to routine |
|
Copyright © 2014 CA Technologies.
All rights reserved.
|
|