A SERVICE OF

logo

122 Chapter 3
Command Definitions C-E
CALC
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" at the beginning of this chapter.
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 3-1 lists some of the logical operators for the CALC command. Enter :HELP
expressions for more information
Table 3-1 Logical Operators - The CALC Command
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
expressions using the AND, NOT, XOR, and OR logical operators, optionally nested within
parentheses.
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