Description: Restarts the current loop iteration. Goto TOP of DO loop.
Legacy RPG400 Example:
C ITER
Modern RPGLE Example:
iter;
Example of Usage:
Here a condition is compared at the ITERATE opcode will loop back to the top of the loop. Personally, I'm not a fan of this technique because it smacks of a new name for an old (GOTO) style of code, but it has its uses:
Dow Fielda < Fieldb;
// some silly maths logic for this code sample
Fielda = x * n / y;
Fieldb = 14 + Fieldz;
FieldC += (Fielda/Fieldc)
// if FieldC is zero then loop to top of the DOW loop and continue
if FieldC = 0;
iter;
endif;
// if FieldC is 99 then loop out of bottom DOW loop and continue
if FieldC = 99;
leave;
endif;
if FieldC = 99;
leave;
endif;
// do some other logic here
enddo;
