##while/##endwhile [ VIRTUOSO CODE GENERATOR Reference Manual ] MPE/iX 5.0 Documentation
VIRTUOSO CODE GENERATOR Reference Manual
#while/#endwhile
Loops over a series of statements as long as the conditional expression
holds true. The #endwhile construct terminates the loop.
Syntax
#while conditional-expression
.
.
#endwhile
Keywords
conditional-expression is either a simple expression which makes use
of the relational operators (=,<>,>,<,>=,<=),
or a compound expression which uses the boolean
operators (AND and OR). The expression can
involve numbers, literal values, or keywords
that have numeric or string values. The
precedence of operators is the same as in
COBOL.
This is a required parameter.
Description
The #while looping construct allows you to loop through a set of Virtuoso
statements as long as the specified expression evaluates to true. It
should be noted that #while does not introduce a new scope during its
operation. It is also essential that the conditional expression
eventually prove false or the Virtuoso Code Generator will be engaged in
an endless loop. The conditional expression is evaluated before the body
of the #while loop is executed. As soon as the conditional expression
evaluates to false, control passes directly to the statement after the
matching #endwhile.
Examples
The following is an example of how to use #while and #endwhile with a
simple conditional-expression.
#LET a = 1
#WHILE a < 5
#LET a = a + 1
#ENDWHILE
In the example above, the loop will be performed four times until the
conditional expression proves false and the #endwhile terminates the
loop.
MPE/iX 5.0 Documentation