The example in Figure 104 demonstrates the structure of a WHILE loop in a Control-O rule.
Figure 104 WHILE Loop Structure
ON RULE = LOOPRULE
OWNER IOAADMIN GROUP MODE PROD RUNTSEC
THRESHOLD
DESCRIPTION SAMPLE LOOP STRUCTURE USING WHILE/ENDWHILE
===========================================================================
DO SET = %%A = 0 GLOBAL N
WHILE %%A LE# 10
DO SET = %%A = %%A %%$PLUS 1 GLOBAL N
DO SHOUT = TO OPER URGENCY R SYSTEM CTO282I
MESSAGE DURING LOOP NUMBER: %%A
ENDWHILE
Explanation
The loop in this rule is for demonstration purposes only. A DO SET statement is used to set a user-defined variable to zero.
WHILE %%A LE# 10
This WHILE statement indicates that if the %%A user-defined variable is less than (LE#) 10, the following statements should be performed.
DO SET=%%A=%%A %%$PLUS 1
The %%A user-defined variable is incremented by one.
DO SHOUT=TO=OPER
MESSAGE DURING LOOP NUMBER: %%A
A SHOUT message notifies the operator as to what loop number the rule is now executing.
ENDWHILE
marks the end of the WHILE loop
Parent Topic |