Protection against uncontrolled looping within a procedure is provided through a loop control counter, maintained automatically by NCL. Runaway loop control can be activated by using &CONTROL LOOPCHK verb. The default is &CONTROL NOLOOPCHK, which means that runaway loop control is not in effect unless requested.
When a procedure commences execution, a count of 1000 is assigned to this counter. This is then decremented by one for each executed &DOEND statement associated with an &DOWHILE or &DOUNTIL, and for each executed &GOTO statement. If the count reaches zero, the procedure is regarded as being in an uncontrolled loop and is automatically terminated.
Certain events that involve operator interaction, indicating that the procedure is not looping, cause this counter to be automatically reset. An example of this occurs when displaying a panel using the &PANEL statement and then having to wait for operator input before processing can continue. In such a case the value for the loop control counter is reset to 1000. The &LOOPCTL verb is provided to enable the user to set a new loop control limit from within the procedure for those procedures that require more than the default value.
Note: &LOOPCTL is decremented for PPOPROC, MSGPROC, LOGPROC, AOMPROC, or CNMPROC. However, it is reset to its full value each time a message is read with &PPOREAD, &MSGREAD, &LOGREAD, &AOMREAD, &CNMREAD, or &INTREAD. The loop control therefore applies only for processing associated with one message.
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |