You are here: Commands > Set with No Preference Equivalents > Set Loop

Set Loop

When you use the Loop command there is a chance that you can accidentally get into an infinite loop.

Set Loop prevents the possibility of an infinite loop by stopping processing after a specified number of commands has been executed for any single record. The procedure is halted with the message "Loop Count Exceeded" is provided when the loop count exceeds the current Set Loop value.

Set Loop requires a positive whole number.

The default value is: 10,000
The maximum value that can be set is: 32,767
Setting the maximum loop value to zero (0) turns off loop testing - always use this option with great caution as this setting allows you to establish situations where a process loops infinitely

Note: Set Loop affects the Loop commands within Group commands and also affects Group commands in general (i.e. the maximum number of lines allowed within Group must be less than 32,767 or the current SET LOOP value).

For more information, see the Loop command.

Example

To abort processing if more than 20 commands are executed for any record:

SET LOOP TO 20