Previous Topic: Debug an MSG Rule

Next Topic: OMEGAMON Rules

MSG Rules Examples

Example 1

Demonstrates how MSG rules can respond to WTOR events as they are generated:

)MSG $HASP426
)INIT        
/*********************************************************/
/* Verify rule is only enabled on our development system */

/*********************************************************/
if OPSINFO('SMFID') ¬= 'SYST' then
  return 'REJECT'
)PROC
/*********************************************************/
/* Reply COLD to the JES2 initialization WTOR message    */
/* MSGTXT - IDNUM $HASP426 SPECIFY OPTIONS - SYST        */
/*********************************************************/
ID = MSG.REPLYID  /* Get REPLYID from  an event variable */
address OPER      /* Set environment to issue cmds       */
"C(R "ID",COLD) NOOUTPUT"   /* Issues a z/OS REPLY command*/

Example 2

Demonstrates how to incorporate REXX tools and OPS/REXX tools to make various automated decisions about a particular event:

)MSG IEF450I
/****************************************************************/
/* Manipulate JOB ABEND messages using the following criteria   */
/* -Suppress all IEF450I except those prefixed with P (PROD)    */
/* -Hilite the abend message if JOBNAME = PMNTHEND              */
/* -Invoke ACCTRECV OPS/REXX program for all PACCT* JOBS        */
/* -Start DRECOVER JOB if PDAILY1 ABENDS with S000 & U0004      */
/* IEF450I AMAJA03 CATSO CATSO - ABEND=S000 U0004 REASON=0000   */
/*   TIME=08.00.18                                              */
/****************************************************************/
)PROC 
if MSG.MLWTOMIN =1 then return  /* No need to look at 2nd line  */
JOB = MSG.JOBNAME               /* Get the JOBNAME that abended */
if SUBSTR(JOB,1,1) ¬= 'P' then  /* suppress all non prod jobs   */
   return 'SUPPRESS'
/****************************************************************/
/* Further manipulate the abending production job               */
/****************************************************************/
select
 / *Hilite message if PMNTHEND abended, setting the descriptor  */
 /* code environmental variable using the OPS/REXX OPSBITS      */
 /* function.                                                   */
 when JOB = 'PMNTHEND' then
   do
     MSG.DESC=OPSBITS('HILITE') 
   end       /*END OF PMNTHEND CHECK*/
 /* If PDAILY1 ABENDs, start DRECOVER JOB only if ABEND code    */
 /* in message is 'S000' with a user code of 'U0004'.           */
 /* Use the REXX PARSE instruction to break down the message.   */
when JOB = 'PDAILY1' then
   do
     parse var MSG.TEXT . 'ABEND=' ACODE UCODE .   
     if ACODE = 'S000' & UCODE = 'U0004' then
       do   
         address OPER        
         "COMMAND(S DRECOVER) NOOUTPUT"
       end                                /*end of code checks   */
   end                                   /*end of pdaily1 check */
 /****************************************************************/
 /* Schedule the ACCTRECV OPS/REXX program to a server if        */
 /* this is a production accounting job (PACCT*). Pass the job   */
 /* to the EXEC. We have to schedule the EXEC to run in a server */
 /* since it will be issuing WTORs to operations and will        */
 /* wait for the operator responses.                             */
 /* Remember that waiting in MSG rules is not allowed!!!         */
 /****************************************************************/
when SUBSTR(JOB,1,5) = 'PACCT' then
   do       
     address OSF                          /* Ship to server     */
     "OI P(ACCTRECV) ARG("JOB")"
   end                                    /* End of PACCT check */
 otherwise RETURN 'NORMAL'                /* NOT A SPECIAL CASE */
end                                       /* END OF SELECT      */

Example 3

Utilize the MLWTO optional keyword to manipulate the data lines of an IEA995I multiline message event. Base actions on data that are contained on different lines of the message.

)MSG IEA995I MLWTO SUPPRESS                          
)Proc                                                
/****************************************************/
/* Suppress all symptom dump messages and generate  */
/* a TSO send message for any 0C3 abend in module   */
/* DMCONPR that occurs. Extract abend,module, and   */
/* PSW from the MLWTO and include in alert message. */
/*  IEA995I SYMPTOM DUMP OUTPUT                     */
/*  SYSTEM COMPLETION CODE=0C3  REASON CODE=00000003*/
/*  TIME=13.04.53  SEQ=17982  CPU=0000  ASID=029C   */
/*  PSW AT TIME OF ERROR  078D0000   B4C9A300  ILC 4*/
/*  ACTIVE LOAD MODULE ADDR=34C9A000 OFFSET=00000300*/
/*  NAME=DMCONPR                                    */
/*  DATA AT PSW  34C9A2FA - 000D4400  B2FC9835      */
/****************************************************/

/****************************************************/
/* Using the msg.text.n variables built using the   */                          
/* MLWTO option on the specifier, obtain the lines  */                          
/* of the IEA995I that have the data we need to     */                          
/* manipulate.                                      */                          
/****************************************************/                          
line2 = msg.text.2                                                              
line6 = msg.text.6                                                              
line7 = msg.text.7                                                              
/****************************************************/                          
/* Further parse out each line to obtain the code   */                          
/* from line 2, the module from line 6, and the PSW */                          
/* from line 7.                                     */                          
/****************************************************/                          
parse var line2 'CODE=' code .                                                  
parse var line6 'NAME=' module .                                                
parse var line7 . 'PSW ' psw .                                                  
/****************************************************/                          
/* Send out TSO send message if this is an 0C3      */                          
/* abend in a DMCONPR module. Include the PSW,      */                          
/* jobname, and smfid in message.                   */                          
/****************************************************/                          
if code = '0C3' & module = 'DMCONPR' then                                       
 do                                                                             
  jobname = msg.jobname                                                         
  smfid   = OPSINFO('SMFID')                                                    
  alertmsg= 'S0C3/DMCONPR abend in 'jobname' on',                               
            'system 'smfid'.'                                                   
  address Oper                                                                  
  "Command(SEND '"alertmsg"',USER=(GORDA05))"                                   
 end