MPE/iX Commands Reference Manual (32650-90877)

102 Chapter4
Command List II
Commands CALC thru COPY
Commands CALC thru COPY
CALC
Evaluates an expression. (Native Mode)
Syntax
CALC
expression
NOTE
This command follows the optional MPE/iX command line syntax. Refer to
"Optional Format for MPE/iX Commands" in chapter 2 “Command Structure
Defined”.
Parameters
expression
The expression to be evaluated.
Operation Notes
The CALC command evaluates
expression
and displays the result to $STDLIST.
Expressions can yield integer, string, or Boolean results. Integer results are displayed in
decimal, hexadecimal ($ prefix), and octal (% prefix) notations. Boolean expressions are
displayed as TRUE or FALSE. The variable HPRESULT is set to the result of the last
expression
evaluated by CALC. The type of HPRESULT changes depending on the type of
result generated by CALC.
Table 4-1. on page 102 lists some of the logical operators for the CALC command. Enter
:HELP expressions for more information
The operands you may use are any variable, integer, string, Boolean constant, or the
system-reserved words WARN, FATAL, SYSTEM, and OK. You may form compound logical
Table 4-1. Logical Operators - The CALC 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