Purpose
Creates a processing loop based on conditions in a specified expression.
Syntax
►►─── WHILE conditional-expression ───────────────────────────────────────────► ┌──────────────────────┐ ►─── repeat. ──────▼─ command-statement. ─┴── END. ──────────────────────────►◄
Parameters
Evaluates the specified expression and returns a true or false value to the dialog.
Conditional-expression contains one or more conditions to be evaluated and is specified according to the rules presented in Conditional Expressions.
Specifies the commands to be executed as long as the WHILE condition is true. REPEAT begins the WHILE command loop. END terminates the loop. Each command is executed sequentially before the conditional expression is evaluated again.
Command-statement can be any valid CA ADS process command, including another conditional command.
Usage
Definition
The WHILE command is used to create a processing loop. One or more process commands are executed repeatedly as long as the conditions in a specified expression are true.
Considerations
Indentation should be used in coding wherever possible to make the statement more readable and to ensure that the required clauses are properly matched.
Example
The following example illustrates the use of the WHILE command with a nested IF command:
MOVE 1 TO CA-INDX.
OBTAIN NEXT SALES WITHIN PRODUCT-SALES.
WHILE NOT DB-END-OF-SET AND CA-INDX LE 45
REPEAT.
IF SALES-AMT GE FULL-AMT
DO.
MOVE SLS-CUST-NUMBER TO CA-CUST(CA-INDX).
ADD 1 TO CA-INDX.
END.
OBTAIN NEXT SALES WITHIN PRODUCT-SALES.
END.
IF DB-END-OF-SET
THEN
INVOKE 'EOS'.
ELSE
RETURN.
|
Copyright © 2014 CA.
All rights reserved.
|
|