OPS/MVS

Expand all | Collapse all

Tuesday Tip: Mirror Mirror on the Wall what is the best OPS/MVS variable of all?

  • 1.  Tuesday Tip: Mirror Mirror on the Wall what is the best OPS/MVS variable of all?

    Posted 08-26-2014 01:15 PM

    The need to create variables is a common coding task within the logic of your automated applications. Within the OPS/MVS tool box, there are many flavors of variables that can be utilized in your OPS/MVS rules and programs to handle this task. More often than not, the wrong type of variable is being chosen which can possibly make the application less efficient, and even have you creating more lines of code than what is needed to perform the desired automated action.

     

    Today’s Tuesday Tip will be part 1 of 5, that will outline the various types of OPS/MVS variables available in rules and programs, providing you with the details needed to effectively utilize them within your applications.  For today’s variable type, we will take a look at Static Variables, with future tip topics discussing local variables, global variables, shared  variables that utilize the OPS/MVS shared data base file, and shared sysplex variables that utilize the CA CCS Common Variable Service component (CAVARSRV).


    OPS/MVS Static Variables

    Static variables maintain their value across multiple executions of a single rule, which means that data can be shared between executions of the same AOF rule. Static variables are primarily useful within AOF rules when you need to keep a running counter of the triggering event, or perhaps compare some condition within the current event, against a value that the event contained in a previous firing of the rule.

     

    For example, consider the following rule logic:

    )MSG $HASP373                                          

    /************************************************************/

    /* Rule Purpose :     Keep a running total of HASP373 jobs  */

    /*                    on this system. Create an audit trail */

    /*                    message of this count upon the rule   */

    /*                    being disabled.                       */

    /************************************************************/

    )Init 

    /************************************************************/

    /* Initialize our static counter variable for this event    */

    /************************************************************/

    count = 0

    )Proc

    count = count + 1                        /* Add to counter  */

    )Term 

    /************************************************************/

    /* Rule being disabled. Create OPSLOG audit trail msg       */

    /************************************************************/

    msgtxt = 'OPSINFO - Total $HASP373 events = 'count

    logit = OPSSEND('*','B',msgtxt)

     

    The variable COUNT is a static variable that retains its value each time this rule processes a $HASP373 message.

     

    Review the following additional facts about static variables:

    • Static variables are rule specific and must be defined (initialized) in the )INIT section.
    • The same static variable name used in the initialization sections of two different rules refers to two different static variables.
    • A static variable cannot be a compound symbol (for example, JOB.COUNT).
    • The name of a static variable can be up to 50 characters in length.
    • The value assigned to a static variable can be up to 256 bytes in length. Any value assigned with a length greater than 256 is truncated.
    • A static variable is deleted when the rule is disabled.

     

         Next week’s Tuesday Tip will look at Address Space (ASID) related variables that will allow you to create uniqueness within rules for common events issued from different address      spaces.



  • 2.  Re: Tuesday Tip: Mirror Mirror on the Wall what is the best OPS/MVS variable of all?

    Posted 07-16-2018 08:29 AM

    Dave,

     

    "Static variables are primarily useful within AOF rules when you need to keep a running counter of the triggering event... " for this particular purpose, would you current recommend using the OPSTHRSH function? I've been trying to use this to control whether or not to take an action depending on how may time the event has occurred in the last xx minutes etc.

     

    thanks,

     

    Steve

     



  • 3.  Re: CA OPS/MVS Tuesday Tip: Mirror Mirror on the Wall what is the best OPS/MVS variable of all?

    Posted 11-28-2014 04:35 AM

    Hello David,

     

    This was interesting for a new person using OPS/MVS. When will the next four articles be coming out?

     

    Thanks

    Mark Noonan



  • 4.  Re: Tuesday Tip: Mirror Mirror on the Wall what is the best OPS/MVS variable of all?

    Broadcom Employee
    Posted 07-17-2018 11:59 AM

    Hi Steve,

     

    The recommend method to avoid repetitive actions from rules is the usage of the function OPSTHRSH. This is a relatively new function (added in OPS 12.2) so, in the past, it was necessary to keep the counter in static variables of AOF rules.

    Just for reference for who may have interest in this function, more information can be found in the link below:

    OPSTHRSH Function - CA OPS/MVS® Event Management and Automation - 13.0 - CA Technologies Documentation 

     

    Regards,
    Mario

    Carlos Mario Filho
    Principal Support Engineer



  • 5.  RE: Re: Tuesday Tip: Mirror Mirror on the Wall what is the best OPS/MVS variable of all?

    Posted 08-08-2021 08:39 PM
    Hi Carlos,

    Can OPSTHRSH be used multiple times in one rule?


    if example:

    if msg = A
       do
          cnt = opsthrsh .......
       end
    if msg = B
     do
         another_cnt = opsthrsh .......
     end

    if cnt = 4 then ...........

    if another_cnt = 8 ..........

    Thanks,
    Mark



  • 6.  RE: Re: Tuesday Tip: Mirror Mirror on the Wall what is the best OPS/MVS variable of all?

    Posted 08-09-2021 08:45 AM

    Multiple OPSTHRSH() type functions can be used in a rule. This is useful then thresholding on events caused by different asids and you want to threshold by 'how many' on the system or 'how many' by a specific jobname/asid. For example, in the IEA611I SVC Dump event rule, we threshold by the number of abends occurring on the system ('E'vent threshold) and by the jobname/asid that abended (using jobname within a 'C'riteria threshold) when we want to threshold on dumps from the same jobname. Would really need to know the exact event and 'outcome' you are expecting to see to determine what is the best logic needed within the rule. It sounds as if you may have a generic msg rule (such as )MSG IEF*). If so , keep in mind that if you have something like )MSG IEF* -  msgid IEF123I would have its 'own' counters, msgid IEF456I would have its 'own' counters, etc . Best way to make sense of it all, is to enable some test rule with all the threshold events, and issue the test WTO from your TSO ID via TSO OPSWTO MSGID(testmsg) Text('Text of msg here') and then from either a pgm or OPSWTO running in a server  or from batch to see the counts dumped from your test rule as they are issued from different asids.  Test rule may look something like:

    )MSG  DAGTEST*                                                          

    )Proc                                                                  

    /* How many times did this triggerring msg id occur from any asid */   

    E_thresh_cnt = OPSTHRSH('E','600')                                     

    say ' E_Thresh_cnt for 'msg.id'='E_thresh_cnt 'issued by 'msg.jobname  

    /* How many times did this triggerring msg id occur from this asid */  

    A_thresh_cnt = OPSTHRSH('A','600')                                     

    say ' A_Thresh_cnt for 'msg.id'='A_thresh_cnt 'issued by 'msg.jobname  

    /* How many tmes did this triggerring msg id have ABCDEF from any asid*/

    c_thresh_cnt = OPSTHRSH('C','600','ABCDEF')                            

    say ' C_Thresh_cnt for 'msg.id'='C_thresh_cnt 'issued by 'msg.jobname


  • 7.  RE: Re: Tuesday Tip: Mirror Mirror on the Wall what is the best OPS/MVS variable of all?

    Posted 08-09-2021 05:29 PM
    Edited by Makn 08-09-2021 05:48 PM
    Hi Dave,

    This is what I observed when I was doing testing in the AOF TEST environment.

    I had been using OPSTHRSH quite nicely, until I started doing some testing in AOF TEST.

    ------ I have now tested in AOF proper, and the OPSTHRSH is doing what I expected. ----- Good.
    If msg.id = "MVAD003S" then    
     do                            
      acnt = opsthrsh('A',120)     
      say 'acnt = 'acnt            
     end                           
    If msg.id = "MVAC004S" then    
     do                            
      bcnt = opsthrsh('A',120)     
      say 'bcnt = 'bcnt            
     end   
    ------ I have now tested in AOF proper, and the OPSTHRSH is doing what I expected. ----- Good.          


    These are what I did in AOFTEST environment that confused me.


    Setup: All messages coming from same address space.

    If these message come from the same address then acnt and bcnt just increment per message, so if 4S came in twice, acnt = 2, then a 5S comes in the bcnt = 3 (not 1) then a 4s comes in the anct is now 4 (not 3).

    If msg.id = "MVAC004S" then
    do
    acnt = opsthrsh('A',60)
    end
    if msg.id = "MVAC005S" then
    do
    bcnt = opsthrsh('A',120)
    end

    If these message come from the same address then acnt and bcnt reset if the criteria are met, so if 4S came in twice, acnt = 2, then a 5S comes in the bcnt = 1 (acnt resets to 0) then a 4s comes in and acnt is now 1 (not 3) the bcnt is reset to 0.

    If msg.id = "MVAC004S" then
    do
    acnt = opsthrsh('A',60,'MVAC004S')
    end
    if msg.id = "MVAC005S" then
    do
    bcnt = opsthrsh('A',120,'MVAC005S')
    end

    If these message come from the same address then acnt and bcnt just increment per message, so if 4S came in twice, acnt = 2, then a 5S comes in the bcnt = 3 (not 1) then a 4s comes in the anct is now 4 (not 3). Same result as scenario one with the E type of opsthrsh.

    If msg.id = "MVAC004S" then
    do
    acnt = opsthrsh('C',60,'MVAC004S')
    end
    if msg.id = "MVAC005S" then
    do
    bcnt = opsthrsh('C',120,'MVAC005S')
    end


    Thanks
    Mark


  • 8.  RE: Re: Tuesday Tip: Mirror Mirror on the Wall what is the best OPS/MVS variable of all?

    Posted 08-09-2021 06:29 PM
    Hi Ron, Dave,

    Thanks. Clear now. I need to test in AOF, not AOFTEST for OPSTHRSH related code.

    Regards,
    Mark.


  • 9.  RE: Re: Tuesday Tip: Mirror Mirror on the Wall what is the best OPS/MVS variable of all?

    Broadcom Employee
    Posted 08-09-2021 05:32 PM
    This would be the normal nature for anything in AOF Test.  Global variables (used to track the threshold events) are stored in the 'real' SYSCHK1, whereas AOF Test creates a private, temporary environment for any data that would otherwise be stored there.

    Ronald Sheehan
    Engineering Services Architect
    Broadcom |  9815 David Taylor Drive, Charlotte | Charlotte, NC 28277
    Office: +1 704-887-7815 | Mobile: +1 704-494-1960 | Ronald.Sheehan@Broadcom.com

    This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.





  • 10.  RE: Re: Tuesday Tip: Mirror Mirror on the Wall what is the best OPS/MVS variable of all?

    Posted 08-10-2021 09:34 AM

    Yes. AOFTEST either needs to be upgraded to 'fully' test OPSTHRSH() 'accurately'  or at least some type of error back that states 'Not supported in AOFTEST'.....