Purpose
Exits IF and ON command processing.
Syntax
►►─── NEXT command ─── . ─────────────────────────────────────────────────────►◄
Usage
Definition
The NEXT command is used to exit IF and ON command processing. When a NEXT command is used, control passes to the command following the IF or ON statement.
Considerations
NEXT is typically used in a nested IF structure as a means of associating an ELSE clause with the correct IF command.
Example
The statements below illustrate the use of the NEXT command to match the second ELSE clause with the second IF command:
IF A = B
THEN
DO.
IF X = Y
THEN
IF Y = Z
THEN
MOVE A TO B.
ELSE
NEXT.
ELSE MOVE B TO A.
SNAP ALL.
DISPLAY.
END.
If A equals B and X equals Y, but Y does not equal Z, control exits from the innermost IF command and passes to the SNAP ALL command. If the ELSE NEXT statement is not included, the ELSE MOVE B TO A statement is matched incorrectly with the third rather than with the second IF.
|
Copyright © 2014 CA.
All rights reserved.
|
|