REXX procedure ERBR3WFX

/* REXX **************************************************************/
/*                                                                   */
/*01* MODULE-NAME: ERBR3WFX                                          */
/*                                                                   */
/*01* DESCRIPTIVE-NAME: WFEX Report Handler Samples                  */
/*                                                                   */
/*01* FUNCTION:                                                      */
/*       ERBR3WFX provides samples to process the RMF                */
/*       Monitor III WFEX report data                                */
/*                                                                   */
/*01* NOTES:                                                         */
/*       None.                                                       */
/*                                                                   */
/*01* OPERATION:                                                     */
/*       Calls the specific WFEX handler subroutine                  */
/*       depending on the input parameter (default = 1)              */
/*                                                                   */
/*01* RECOVERY-OPERATION: None                                       */
/*                                                                   */
/*01* DEPENDENCIES: RMF Monitor III Reporter phase 3 context         */
/*                                                                   */
/*01* INVOCATION:                                                    */
/*       1. ISPEXEC SELECT CMD(ERBR3WFX 1)                           */
/*       2. ISPEXEC SELECT CMD(ERBR3WFX 2)                           */
/*       3. ISPEXEC SELECT CMD(ERBR3WFX 3)                           */
/*       4. ISPEXEC SELECT CMD(ERBR3WFX)                             */
/*                                                                   */
/*01* CALLER: ERB3RPH3                                               */
/*                                                                   */
/*********************************************************************/
Trace 0

Arg handler .

ADDRESS ISPEXEC
CONTROL ERRORS RETURN

hc = 0
msgid = "RMF100I 3B:"
name = "Name      "
reasn = "Reason       "
delay = "Critical val."
process = "Processing WFEX Report..."
wtomsg1 = msgid process
/*-------------------------------------------------------------------*/
/* Header lines for samples 2+3                                      */
/*-------------------------------------------------------------------*/
wtomsg2 = msgid name reasn delay
wtomsg3 = msgid SUBSTR("-",1,38,"-")

"SELECT PGM(ERBCSWTO) PARM("wtomsg1")"

Select
  When handler = '1' Then
  Do
    rc = Wfex_Handler_1()
  End
  When handler = '2' Then
  Do
    "SELECT PGM(ERBCSWTO) PARM("wtomsg2")"
    "SELECT PGM(ERBCSWTO) PARM("wtomsg3")"
    rc = Wfex_Handler_2()
  End
  When handler = '3' Then
  Do
    "SELECT PGM(ERBCSWTO) PARM("wtomsg2")"
    "SELECT PGM(ERBCSWTO) PARM("wtomsg3")"
    rc = Wfex_Handler_3()
  End
  Otherwise
  Do
    rc = Wfex_Handler_1()
  End
End

Exit rc
/*********************************************************************/
/*                                                                   */
/*01* SUBROUTINE-NAME: Wfex_Handler_1                                */
/*                                                                   */
/*01* DESCRIPTIVE-NAME: WFEX Report Handler - Sample 1               */
/*                                                                   */
/*01* FUNCTION:                                                      */
/*       This subroutine provides a sample for a general WTO         */
/*       notification in case of Monitor III exceptions              */
/*                                                                   */
/*01* OPERATION:                                                     */
/*       1. checks if one or more WFEX exception lines exist         */
/*       2. if yes, issues WTO message RMF101I and sets              */
/*          the hardcopy request to 1                                */
/*                                                                   */
/*********************************************************************/
Wfex_Handler_1: Procedure

tabnam = "ERBWFXT3"
msgid = "RMF101I 3B:"
msgtext = "WFEX Exception(s) Encountered"

hc = 0
excpnum = 0
"TBQUERY" tabnam "ROWNUM(excpnum)"
If RC = 0 Then
Do
  If excpnum > 0 Then
  Do
    wtomsg = msgid excpnum msgtext
    "SELECT PGM(ERBCSWTO) PARM("wtomsg")"
    hc = 1
  End
End
Else return 12

return hc
/*********************************************************************/
/*                                                                   */
/*01* SUBROUTINE-NAME: Wfex_Handler_2                                */
/*                                                                   */
/*01* DESCRIPTIVE-NAME: WFEX Report Handler - Sample 2               */
/*                                                                   */
/*01* FUNCTION:                                                      */
/*       This subroutine provides a sample for a general WTO         */
/*       transformation of Monitor III exception lines with          */
/*       an additional filter for slight exceptions.                 */
/*                                                                   */
/*01* OPERATION:                                                     */
/*       1. loops through the WFEX exception data table              */
/*       2. scans for slight exceptions and skips it                 */
/*          (here OPER-Message and Not avail)                        */
/*       3. if one or more exception lines are remaining:            */
/*          issues WTO message RMF102I and sets the                  */
/*          hardcopy request to 1                                    */
/*                                                                   */
/*********************************************************************/
Wfex_Handler_2: Procedure

tabnam = "ERBWFXT3"
msgid = "RMF102I 3B:"

oper_message = "OPER-Message"       /* Sets the filter 1             */
not_avail = "Not avail"             /* Sets the filter 2             */

hc = 0
excpnum = 0
"TBQUERY" tabnam "ROWNUM(excpnum)"
If RC = 0 Then
   "TBTOP" tabnam
If RC = 0 Then
  "TBSKIP" tabnam

If RC = 0 Then
Do While (RC = 0)                   /* Loops through the table       */

  If (SUBSTR(wfxreasn,1,12) \= oper_message) &,
     (SUBSTR(wfxreasn,1,9) \= not_avail) Then
  Do
    msgtext = SUBSTR(wfxname,1,11) ||,
              SUBSTR(wfxreasn,1,14) ||,
              SUBSTR(wfxdelay,1,14)
    wtomsg = msgid msgtext
    "SELECT PGM(ERBCSWTO) PARM("wtomsg")"
    hc = 1
  End
  "TBSKIP" tabnam
End
Else return 12

return hc
/*********************************************************************/
/*                                                                   */
/*01* SUBROUTINE-NAME: Wfex_Handler_3                                */
/*                                                                   */
/*01* DESCRIPTIVE-NAME: WFEX Report Handler - Sample 3               */
/*                                                                   */
/*01* FUNCTION:                                                      */
/*       This subroutine provides a sample for the search of         */
/*       specific Monitor III exception lines and subsequent         */
/*       threshold handling.                                         */
/*                                                                   */
/*01* OPERATION:                                                     */
/*       1. loops through the WFEX exception data table              */
/*       2. scans for CPU-utilization and Storage-ECSA-usage         */
/*          exceptions                                               */
/*       3. if the internally defined thresholds are exceeded:       */
/*          issues WTO messages with individual message ids          */
/*          (RMF103I, RMF104I) and sets the hardcopy request         */
/*          to 1                                                     */
/*                                                                   */
/*********************************************************************/
Wfex_Handler_3: Procedure

tabnam = "ERBWFXT3"

proc = "*PROC"
cpus = "CPUS%"                      /* Set the exception type        */
cpus_limit = "90"                   /* Set the threshold             */
cpus_msgid = "RMF103I 3B:"

ecsa = "*ECSA*"
secs = "SECS%"                      /* Set the exception type        */
secs_limit = "60"                   /* Set the threshold             */
secs_msgid = "RMF104I 3B:"

hc = 0
excpnum = 0
"TBQUERY" tabnam "ROWNUM(excpnum)"
If RC = 0 Then
  "TBTOP" tabnam
If RC = 0 Then
  "TBSKIP" tabnam

If RC = 0 Then
Do While (RC = 0)                   /* Loops through the table       */
  If (SUBSTR(wfxname,1,5) = proc) &,
     (SUBSTR(wfxreasn,1,5) = cpus) &,
     (SUBSTR(wfxdelay,2,2) >= cpus_limit) Then
  Do                                /* CPUS%  Threshold exceeded ?   */
    msgtext = SUBSTR(wfxname,1,11) ||,
              SUBSTR(wfxreasn,1,14) ||,
              SUBSTR(wfxdelay,1,14)
    wtomsg = cpus_msgid msgtext
    "SELECT PGM(ERBCSWTO) PARM("wtomsg")"
    hc = 1
  End
  If (SUBSTR(wfxname,1,6) = ecsa) &,
     (SUBSTR(wfxreasn,1,5) = secs) &,
     (SUBSTR(wfxdelay,2,2) >= secs_limit) Then
  Do                                /* SECS% Threshold exceeded ?    */
    msgtext = SUBSTR(wfxname,1,11) ||,
              SUBSTR(wfxreasn,1,14) ||,
              SUBSTR(wfxdelay,1,14)
    wtomsg = secs_msgid msgtext
    "SELECT PGM(ERBCSWTO) PARM("wtomsg")"
    hc = 1
  End
  "TBSKIP" tabnam
End
Else return 12

return hc