Specify the jobname issuing a test WTO from REXX
search cancel

Specify the jobname issuing a test WTO from REXX

book

Article ID: 252257

calendar_today

Updated On:

Products

OPS/MVS Event Management & Automation

Issue/Introduction

I am creating a simple OPSEREXX program with address WTO to generate a multi-line WTO. When executed, understandably I see the jobname for the generated WTO is my USERID in OPSLOG. But I need to change the jobname in my OPSREXX from my USERID to a CICS name for testing purposes. Below is the OPSREXX program.

LINE.1 = 'SVC DUMP HAS CAPTURED'
LINE.2 = 'DUMPID=452 REQUESTED BY JOB (TESTCICS)'
LINE.0 = 2
address WTO "TEXTVAR(LINE.) MSGID(TESTMSG)"
say RC
exit

I am currently working on an automation solution where OPS/MVS will be sending emails to engineering team when DUMP messages are trapped and when the below condition is satisfied.

If OPSMVS traps IEA794I for the 3rd time in 15 minutes and if the jobname remains the same then, OPSMVS should send an email/alert.

I am thinking of accomplishing this with OPSTHRSH function but I need to test this before I put it into production. Hence I am trying to generate few WTOs with same MSGID and different jobnames.

Environment

Release : 13.5 14.0

Resolution

Under normal circumstances, when executing a REXX exec that issues a WTO, the jobname is derived from the ASCB of the task or user ID that executed the REXX, either the OSF server STC ID or TSO user ID. There is no way to specify the jobname from within the REXX itself.

However, if the REXX issuing the WTO is called from a batch job, then the jobname associated with the WTO will be that of the batch job. So in this case, several batch jobs with differing job names can be created that call the same REXX. The issue that might arise is that an arbitrary batch job name may not have sufficient authority to issue the WTO:

Job Name ----+----1----+----2----+----3----+----4----+----5----+----6----+----7
CICSXYZ  IEF403I CICSXYZ - STARTED - TIME=10.18.27                             
CICSXYZ  OPSWTO                                                                
CICSXYZ  OPS1342E CURRENT OPSWTO COMMAND NOT AUTHORIZED - insufficient authority
CICSXYZ  IEF404I CICSXYZ - ENDED - TIME=10.18.27

This can be resolved during testing on a test system by temporarily allowing unrestricted access to OPS/MVS functions by enabling the following SEC rule:

)SEC *       
)PROC        
RETURN ACCEPT

Then the REXX can be called from the batch jobs using the following code and altering the jobname in green:

Batch JCL:

//CICSXYZ  JOB (12490000),'MYUSERID',CLASS=A,NOTIFY=&SYSUID,     
//         MSGCLASS=H,REGION=0M,MSGLEVEL=(1,1)                  
//STEP1    EXEC PGM=OX,PARM='HLQ.USER.REXX(WTOTEST) CICSXYZ'
//STEPLIB  DD   DSNAME=HLQ.OPS140.CCLXLOAD,DISP=SHR      
//SYSPRINT DD   SYSOUT=X                                        

WTOTEST REXX:

ARG JOBNAME    <=== jobname argument from the batch job calling the REXX                                         
LINE.1 = 'SVC DUMP HAS CAPTURED'                        
LINE.2 = 'DUMPID=452 REQUESTED BY JOB ('JOBNAME')'  <=== JOBNAME variable will be the jobname passed from the batch job.  
LINE.0 = 2                                              
ADDRESS WTO "TEXTVAR(LINE.) MSGID(TESTMSG)"             
/* SAY RC */                                            
EXIT                                                    

Executing the batch job now results in the following in OPSLOG:

Job Name ----+----1----+----2----+----3----+----4----+----5----+----6----+----7
CICSXYZ  $HASP373 CICSXYZ  STARTED - INIT 1    - CLASS A        - SYS XE38     
CICSXYZ  IEF403I CICSXYZ - STARTED - TIME=12.33.45                             
CICSXYZ  OPSWTO                                                                
CICSXYZ  OPS1370H CICSXYZ  X'0000' X'0000' X'0000' NONE  300 TESTMSG    SVC DUM
CICSXYZ  TESTMSG SVC DUMP HAS CAPTURED                                         
CICSXYZ  DUMPID=452 REQUESTED BY JOB (CICSXYZ)                                 
CICSXYZ  IEF404I CICSXYZ - ENDED - TIME=12.33.45                               
CICSXYZ  CICSXYZ JOB06150 ENDED MAXCC=00000 SUBSYS=JES2                        

This meets the requirement of having the WTO issued under an arbitrary jobname as set in the batch JCL.

NOTE: The SEC rule must be disabled once testing is complete.

Additional Information

Security Rules:

https://techdocs.broadcom.com/us/en/ca-mainframe-software/automation/ca-ops-mvs-event-management-and-automation/14-0/using/using-automated-operations-facility-aof-rules/coding-each-aof-rule-type/security-rules.html

Execute Source OPS/REXX Programs from Batch:

https://techdocs.broadcom.com/us/en/ca-mainframe-software/automation/ca-ops-mvs-event-management-and-automation/14-0/using/using-ca-ops-mvs/using-ops-rexx/execute-source-ops-rexx-programs.html#concept.dita_381485055aada5b4c649a3d20fabcbedc778a219_ExecuteOPSREXXProgramsfromBatch