The EXIT statement terminates execution of a DO construct. It takes the following form:
The EXIT statement causes execution of the named (or innermost) DO construct to be terminated.
If a DO construct name is specified, the EXIT statement must be within the range of that construct.
Any DO variable present retains its last defined value.
An EXIT statement can be labeled, but it cannot be used to terminate a DO construct.
The following example shows an EXIT statement:
LOOP_A : DO I = 1, 15
N = N + 1
IF (N > I) EXIT LOOP_A
END DO LOOP_A