DO construct

The DO construct specifies the repeated execution of a statement block. Such a repeated block is called a loop.

The iteration count of a loop can be determined at the beginning of execution of the DO construct, unless it is infinite.

You can curtail a specific iteration with the CYCLE statement, and the EXIT statement terminates the loop.

Read syntax diagramSkip visual syntax diagramDO_statement

Read syntax diagramSkip visual syntax diagramstatement_block

Read syntax diagramSkip visual syntax diagramEND_DO_statementterminal_statement
DO_statement
See DO for syntax details
END_DO_statement
See END (Construct) for syntax details
terminal_statement
is a statement that terminates the DO construct. See below.

If you specify a DO construct name on the DO statement, you must terminate the construct with an END DO statement with the same construct name. Conversely, if you do not specify a DO construct name on the DO statement, and you terminate the DO construct with an END DO statement, you must not have a DO construct name on the END DO statement.