% UNTIL/WHILE

Establish a loop and test a condition to execute a subordinate statement block either until or while a single or compound condition is satisfied.
Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

Syntax:

 % UNTIL|WHILE condition
				
				statementblock
				[% END]

Parameters:

condition Valid values are a
  • Constant numeric term.
  • Relational operator =, NOT =, <, >, NOT <, NOT >, <=, >=.
  • Variable that has a numeric true/false value

AND or OR may connect multiple logical terms. Do not use parentheses.

Comments:

  • During processing, the Customizer moves % UNTIL and % WHILE statement blocks to the starting columns of their controlling % UNTIL and % WHILE statements.
  • The % UNTIL statement block executes until the condition is true. Conversely, the % WHILE statement block executes while the condition is false.
  • When the % UNTIL condition is true or the % WHILE condition is false, the loop ends without executing the % UNTIL or % WHILE statement block, and processing resumes at the next line that has the same or less indentation as the % UNTIL or % WHILE.
  • AMB provides an internal loop counter, LOOP-LIMIT, which defaults to 500. To override the default, change the value of % SET LOOP-LIMIT in the AMB CNTL file APSDBDC. You can override the default with a number as high as 999999. Because some AMB libraries reset LOOP-LIMIT to 200, you might need to reset the limit after an % INCLUDE statement.
  • AMB evaluates any evaluation bracket source in an % UNTIL and % WHILE statement block at each iteration of the loop; AMB evaluates bracketed source in a % REPEAT and % REPEAT VARYING statement block just once.
  • Use % UNTIL or % WHILE with a % REPEAT loop to add a conditional test to the % REPEAT loop.