The CYCLE command can be used only in loops. It terminates the processing of the command sequence in a loop and branches to the relevant end-of-loop command, where procedure execution is resumed.
In the case of REPEAT loops, the UNTIL end-of-loop command contains the loop condition; this condition is checked and, if appropriate, the next loop pass is initiated. In the case of FOR and WHILE loops, the end-of-loop commands (END-FOR, END-WHILE) contain the branch back to the beginning of the loop. There, the loop condition is rechecked and, if appropriate, the next loop pass is initiated.
The loop to which the command call is to refer can be addressed in the CYCLE command call either implicitly by the preset value *LAST or explicitly using the name of the tag that precedes the loop initiation command.
Example
/LOOP: WHILE (COND < 9) /... /IF (INP='*IGN') / CYCLE LOOP /... /END-WHILE “Executed after CYCLE, i.e. return to WHILE”
Note
If - as in this example - the CYCLE command is used in an IF block (or in a single block), then the CYCLE command must specify a tag to identify the relevant loop block.