The &LOOPCTL verb sets a new runaway loop control limit when &CONTROL LOOPCHK is in effect. If the default, &CONTROL NOLOOPCHK, is in effect, the &LOOPCTL is ignored.
When a new procedure nesting level begins, &LOOPCTL is initialized to 1000. This value decrements by 1 for each &GOTO, &GOSUB, or &DOEND processed for a &DOWHILE, or &DOUNTIL statement. If the &LOOPCTL reaches 0, the procedure is terminated for being a potential runaway loop. &LOOPCTL is set to a new value, avoiding premature termination of a procedure.
This verb has the following format:
&LOOPCTL number
Operands:
Specifies a numeric value in the range 1 through 10,000.
Examples: &LOOPCTL
&LOOPCTL 2000 &IF &LOOPCTL < 200 &THEN + &LOOPCTL 700
Notes:
&LOOPCTL is also a system variable that returns the current loop control counter value.
Certain system functions imply a reset of the current loop counter. For example, the successful displaying of a panel using the &PANEL statement. In such a case where a panel is displayed awaiting operator input, the current loop counter is reset to 1000. This feature eliminates the need to reset the counter using &LOOPCTL in procedures that perform long processing runs, but which are not looping.
Resetting &LOOPCTL within PPOPROC, MSGPROC, CNMPROC, and LOGPROC should not be necessary. Although these are decremented as is usual, &LOOPCTL is automatically reset when each &PPOREAD, &MSGREAD, &CNMREAD, &LOGREAD, and &INTREAD is issued. Thus, it is only necessary to reset it within a procedure where an abnormally high amount of processing is being performed for a single message.
| Copyright © 2009 CA. All rights reserved. |
|