HPlogo MPE/iX Commands Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 8 Command Definitions SP-Z

WHILE

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

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 8-1 “Logical Operators - The WHILE Command” lists the operators that may be incorporated in expression.

Table 8-1 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

 

Use HELP FUNCTIONS |OPERATORS |EXPRESSIONS for more info

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
ENDWHILE

Related Information

Commands

ELSE, ELSEIF, ENDWHILE, ESCAPE, IF, RETURN, SETVAR, SHOWVAR

Manuals

Appendix B, "Expression Evaluator Functions"

Feedback to webmaster