Previous Topic: Debug an MSG RuleNext Topic: OMEGAMON Rules


Example: MSG Rules

  1. The following example 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 event variable     */
    address OPER      /* Set environment to issue cmds       */
    "C(R "ID",COLD) NOOUTPUT"   /* Issue z/OS REPLY command  */
    
  2. The following example demonstrates how you can 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)    */
    /* -Hilight 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      */
    
  3. The following example suppresses all VTAM IST663I MLWTO messages, but will re-issue the WTO if a particular application is failing. This is an example that only shows how to correlate data between the primary and secondary lines of MLWTOs.
    )MSG IST663I 
    )PROC
    /*********************************************************************/
    /* This rule fires on the multi-line VTAM IST663I message. The logic */
    /* is to suppress the multi-line message, only for a particular      */
    /* application. This application is part of the 1st data line of the */
    /* message. Multi-line message suppression must be done on the       */
    /* primary line of the multi-line message. Therefore, the logic of   */
    /* this rule is to initially suppress the MLWTO, save the data lines */
    /* in a unique variables, set a flag if the message is generated by  */
    /* some other application, and then re-WTO the saved variables if    */
    /* necessary.                                                        */
    /*********************************************************************/
    /*********************************************************************/
    /* Get the WTOID of this message so that we can use this as part of  */
    /* variable name to create uniqueness since the IST663I can be       */
    /* issued by multiple tasks within VTAM at the same time.            */
    
    /*********************************************************************/
    WTOID = C2D(MSG.WTOID)
    
    /*********************************************************************/
    /* If this is the primary line, then set up the unique variables,    */
    /* one to be used as a flag to determine if the message should be    */
    /* re-issued, one to keep count of the total number of lines in this */
    /* MLWTO, and another to save the message text of each line. Return  */
    /* suppress on the primary to cause initial suppression of message.  */
    /*********************************************************************/
    
    if MSG.MLWTOMIN = 0 then
      do
        GLVTEMP1.WTOID.CNT = '1'
        GLVTEMP1.WTOID.REISSUE = 'YES'
        GLVTEMP1.WTOID.MSG.1 = MSG.TEXT
        return 'SUPPRESS'
      end
    
    /*********************************************************************/
    /* This is a data line. Check to see if we are processing the data   */
    /* line that contains the application name that determines if the    */
    /* message should be re-issued or not. If the application is present */
    /* then set the reissue flag variable for this WTOID to no.          */
    /* Increase message counter and save message.                        */
    /*********************************************************************/
    
    if WORD(MSG.TEXT,1) = 'IST664I' then
      do
        parse var MSG.TEXT .'OLU = 'OLU .
        if OLU = 'USILDA01' then
          GLVTEMP1.WTOID.REISSUE = 'NO'
      end
    
    GLVTEMP1.WTOID.CNT = GLVTEMP1.WTOID.CNT + 1
    MSGNO = GLVTEMP1.WTOID.CNT
    GLVTEMP1.WTOID.MSG.MSGNO = MSG.TEXT
    /*********************************************************************/
    /* This is the end line. Check the reissue flag. If it is set to     */
    /* YES (not desired suppress application) then reissue the MLWTO to  */
    /* the local master console (or your desired console or route code). */
    /* Note that the msgid of the ADDRESS WTO command must not be        */
    /* IST663I. Setting it the same will cause a loop to occur.          */
    /* Remove the variables that this MLWTO created.                     */ 
    /*********************************************************************/
    
    if BITAND(MSG.FLAGS,'0600'X) = '0600'X & ,
         GLVTEMP1.WTOID.REISSUE = 'YES' then
      do 
        do I = 1 to GLVTEMP1.WTOID.CNT
          TEXT.I = GLVTEMP1.WTOID.MSG.I
        end             
        LOCALMSTR=OPSINFO('LOCMSTCONSNM')
        address WTO
        "MSGID('IST663O') TEXTVAR(TEXT.) CNNAME("LOCALMSTR")"
      end
    
    /**********************************************************************/
    /* Delete variables for messages.                                     */
    /**********************************************************************/
    
    if BITAND(MSG.FLAGS,'0600'X) = '0600'X then
      REMOVEGLVS = OPSVALUE('GLVTEMP1.'WTOID,'R')