Previous Topic: Debug an MSG RuleNext 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      */