HP 3000 Manuals

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


MPE/iX Commands Reference Manual Volume I

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 2-5 lists the logical operators for the CALC command. Table 2-5. 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 | | | | -------------------------------------------------------------------------------------------- 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. Do not use the FINFO function with the CALC command for remote files. It ignores their existence and returns incorrect information. Use This command is available in a session, job, program, or in BREAK. Pressing Break terminates the INPUT( ) function. Example The result of CALC sample depends on the value entered for sample and on the type of the value, as shown in table 2-6. Table 2-6. Results of CALC ----------------------------------------------------------------------------------------------- | | | | | sample | Displayed (HPRESULT) | Type | | | | | ----------------------------------------------------------------------------------------------- | | | | | 5*10-7 | 43, $2B, %53 | Integer | | | | | | LEN("abc") | 3, $3, %3 | Integer | | | | | | UPS("Abc") | ABC | String | | | | | | 1=1 | TRUE | Boolean | | | | | | MAX(1,0,abs(-12),10) | 12, $c, %14 | Integer | | | | | ----------------------------------------------------------------------------------------------- Related Information Commands DELETEVAR, ELSEIF, IF, SETJCW, SETVAR, SHOWJCW, SHOWVAR, WHILE Manuals Appendix B, "Expression Evaluator Functions" Command Interpreter Access and Variables Programmer's Guide (32650-90011)


MPE/iX 5.0 Documentation