HP 3000 Manuals

ELSEIF [ MPE/iX Commands Reference Manual Volume I ] MPE/iX 5.0 Documentation


MPE/iX Commands Reference Manual Volume I

ELSEIF 

Provides an alternate execution sequence within an IF statement.  Native
Mode

Syntax 

ELSEIF expression [THEN]

Parameters 

expression            Logical expression, consisting of operands and
                      relational operators.  The THEN keyword is
                      optional.  It may be used or omitted and has no
                      effect on the results.  The operators listed in
                      table 2-12 may be incorporated in expression.

          Table 2-12.  Logical Operators - The ELSEIF 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                                       |
|                                    |                                                     |
--------------------------------------------------------------------------------------------

Operation Notes 

The ELSEIF command is used only in conjunction with the IF command.  The
ELSEIF command provides a way of avoiding nested IF statements.  ELSEIF
has meaning only when used after an IF construct.

Any number of ELSEIF commands may follow an IF command.  In contrast,
only one ELSE command may follow an IF or ELSEIF command.  Refer to the
ELSE and IF commands.

Use 

This command may be issued from a session, job, program, or in BREAK.
Pressing Break has no effect unless expression contains the INPUT
evaluator function.

Example 

The following example illustrates using the ELSE command with the IF
command:

     IF EXPN1 THEN
        ...
     ELSE
        IF EXPN2 THEN
           ...
        ELSE
           IF EXPN3 THEN
              ...
           ELSE
              ...
           ENDIF
        ENDIF
     ENDIF

The same result can be accomplished more efficiently by using the ELSEIF
command:

     IF EXPN1 THEN
        ...
     ELSEIF EXPN2 THEN
        ...
     ELSEIF EXPN3 THEN
        ...
     ELSE
        ...
     ENDIF

Notice that only one ELSE may follow an ELSEIF, while any number of
ELSEIF commands may follow an IF.

Related Information 

Commands      CALC, DELETEVAR, ELSE, ENDIF, IF, SETJCW, SETVAR, SHOWJCW,
              SHOWVAR

Manuals       None



MPE/iX 5.0 Documentation