Previous Topic: Dynamic Variables

Next Topic: Address Space-related Variables

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.

For example, consider the following rule logic:

)MSG $HASP373
)INIT
COUNT=0
)PROC
/************************************************************/
/* Rule Purpose :     Keep a running total of HASP373 jobs  */
/* $HASP373 jobname   STARTED                               */
/************************************************************/
COUNT= COUNT + 1                         /* Add to counter  */
)TERM
LOGIT = OPSSEND('*','B','OPSAUTO4 TOTAL 373 = 'COUNT)

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: