CALC

Generated from C.60.01 /SYS/PUB/CICAT last modified on Thu Jan 11 09:18:52 2001

Back to Main Index


CALC


     Evaluates an expression.  (NM)

SYNTAX


     CALC expression


PARAMETERS


expression          The expression to be evaluated.


OPERATION


     The CALC command evaluates an 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.  HPRESULT's type
     changes, depending on the type of result generated by CALC.

     Do not use the FINFO function with CALC to get information on
     remote files.  FINFO ignores them and returns incorrect
     information.

     The operands allowed in an expression are:  any variable, integer,
     string, or Boolean constants, and the system-reserved words WARN,
     FATAL, SYSTEM, OK.  Compound logical expressions can be formed
     using the AND, NOT, XOR, and OR logical operators, optionally
     nested within parentheses.

     o  To see a list of expression evaluator functions, type
        FUNCTIONS at the HELP prompt.  Or, you may enter an
        individual function name for more specific information.

     o  To see a list of FINFO options, type FINFO at the HELP prompt.

     o  To see a list of predefined MPE/iX variables, type VARIABLES
        at the HELP prompt.  Or, you may enter an individual variable
        name for more specific information.

     This command is available in a session, job, program, or in
     break. Pressing [BREAK] terminates the INPUT() function.


EXAMPLE(S)


     The result of CALC EXPRESSN depends on the value entered
     for EXPRESSN and on the type of the value:

                    Results of CALC EXPRESSN
                      (Contents of HPRESULT)

EXPRESSN               Displayed            Type (HPRESULT)
------------------------------------------------------------
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

ADDITIONAL INFORMATION


Commands:   SETVAR, SHOWVAR, DELETEVAR, SETJCW, SHOWJCW, IF, ELSEIF,
            WHILE; see also FUNCTIONS and VARIABLES

Manuals :   MPE/iX Commands Reference Manual (32650-90003).
            Command Interpreter Access and Variables Programmer's
              Guide (32650-90011)

Back to Main Index