WHILE [ MPE/iX Commands Reference Manual Volume I ] MPE/iX 5.0 Documentation
MPE/iX Commands Reference Manual Volume I
WHILE
Used to control the execution sequence of a job, session, UDC, or command
file. (Native Mode)
Syntax
WHILE expression[DO]
Parameters
expression Logical expression, consisting of operands and
relational operators. Table 2-27 lists the
operators that may be incorporated in expression.
Table 2-28. Logical Operators - The WHILE Command
--------------------------------------------------------------------------------------------
| | |
| Logical operators: | AND, OR, XOR, NOT |
| | |
- -
| | |
| Boolean functions and values: | BOUND, TRUE, FALSE, ALPHA, ALPHANUM, NUMERIC, ODD |
| | |
- -
| | |
| Comparison operators: | =, <>, <, >, <=, >= |
| | |
- -
| | |
| Bit manipulation operators: | LSL, LSR, CSR, CSL, BAND, BOR, BXOR, BNOT |
| | |
- -
| | |
| Arithmetic operators: | MOD, ABS, * , / , + , -, ^ (exponentiation) |
| | |
- -
| | |
| Functions returning strings: | CHR, DWNS, UPS, HEX, OCTAL, INPUT, LFT, RHT, RPT, |
| | LTRIM, RTRIM, STR |
| | |
- -
| | |
| Functions returning integers: | ABS, LEN, MAX, MIN, ORD, POS, TYPEOF |
| | |
- -
| | |
| Other functions: | FINFO, SETVAR |
| | |
--------------------------------------------------------------------------------------------
The WHILE command evaluates expression and displays the result (TRUE or
FALSE) to $STDLIST. If expression does not resolve to a Boolean result,
an error is reported.
The DO keyword is optional. It may be used or omitted and has no affect
on the results.
Operation Notes
This command begins a WHILE block, which consists of all the commands
lying between WHILE and the next ENDWHILE statement. The ENDWHILE must
have the same nesting level as the WHILE statement. The ENDWHILE
statement ends the WHILE block.
The logical expression is evaluated and, as long as expression evaluates
to TRUE, the WHILE block is executed.
Nesting of IF and WHILE blocks is limited to a combined total of 30
levels. Each IF or WHILE block read by the Command Interpreter
increments the nesting count by 1.
NOTE You may not write a WHILE construct in such a way that it
physically crosses from one user command (UDCs or command files) to
another.
Use
This command may be issued from a session, job, program, or in BREAK.
Pressing Break aborts the execution of this command.
Example
The following is an example of the WHILE command:
WHILE SETVAR (FILENAME, &
INPUT ("PLEASE ENTER THE NEXT FILENAME TO PURGE:") &
)<> "" DO
PLEASE ENTER THE NEXTFILENAME TO PURGE: OLDFILE1
*** EXPRESSION TRUE
CONTINUE
PURGE !FILENAME
ECHO ![UPS(FILENAME)] HAS BEEN PURGED!
OLDFILE1 HAS BEEN PURGED!
ENDWHILE
Related Information
Commands DELETEVAR,ELSE, ELSEIF, ENDWHILE, ESCAPE, IF,
RETURN, SETVAR, SHOWVAR
Manuals Appendix B, "Expression Evaluator Functions"
MPE/iX 5.0 Documentation