COMPUTE                                                                 COMPUTE



     The COMPUTE command is summarized as follows:

          COMPUTE is a reclassification command which creates a new real
          attribute by performing mathematical operations and functions on
          integer and real attributes.  The mathematical expression may
          contain multiple attribute names, feature attribute names (area,
          perimeter,length), numerical values, mathematical operations,
          mathematical functions, and parentheses.  The available math
          operations are addition, subtraction, multiplication, division,
          exponentiation, maximization, minimization, covering, and averaging.
          The available math functions are square root, logarithm, natural
          logarithm, truncated integer, rounded integer, absolute value,
          tangent, cosine, sine, arctangent, arccosine, and arcsine.  The
          resulting new attribute is of type real and is placed in the
          multiple attribute file.  The new attribute field, like all multiple
          attribute fields, can then be used through other commands, e.g.,
          SELECT ATTRIBUTE, BSEARCH, STATISTICS DESCRIBE, EDITATT, and REPORT.


     The COMPUTE command is specified as follows:

          COMPUTE (active ID)  (attribute or value)  (operation)  ,
          (attribute or value)  (operation)  (function)  ,
          (  (attribute or value)  )  FOR (newattribute)


     The individual phrases of the COMPUTE command are described below.

          (active ID) is the ID number of a vector map referenced in the 
          active map table which contains the multiple attributes to be
          computed.

          FOR (newatribute) is an optional modifying phrase which specifies
          (newattribute) as the name to be assigned to the new real computed
          attribute.  This name may not be one which is already being used
          for an attribute.  If omitted, the name "THATATTR" is assumed.

          , is an optional modifying phrase which indicates that the present
          command is to be continued by skipping immediately to the beginning
          of the next input line.

     The remaining phrases may be used repeatedly in various combinations to
     form mathematical expressions.  These expressions may include up to 128
     phrases, or up to 64  names or numerical values, whichever comes 
     first.  To comply with legal syntax, each phrase specifies the legal
     choice of phrases which may follow it, and whether or not that phrase may
     legally begin or end a mathematical expression.  Only those phrases which
     may end an expression may be followed by the FOR phrase.  It is legal to
     follow any of these with the "," phrase to indicate continuation.

          (attribute or value)  is an optional modifying phrase which specifies
          either an attribute name, feature attribute name (AREA, PERIMETER,
          LENGTH), or a numerical value to be used as an operand in a math-
          ematical operation or function.  If an attribute name is specified,
          it must be an existing attribute name and the number of characters
          entered must uniquely specify the attribute.  Attributes can not
          begin with the characters AREA, PERI, or LENG or they will be consid-
          ered feature attributes.  This phrase is valid to either begin or
          end an expression.  The legal phrases which may follow (attribute
          or value) are:  )  (operation).

          (function)  is an optional modifying phrase which specifies the math-
          ematical function to be performed.  A function is performed upon one
          operand.  This phrase may be used to begin an expression.  The avail-
          able functions are listed below and must be typed exactly as speci-
          fied to distinguish them from attribute names and other phrases.  The
          only legal phrase which may follow (function) is  (.  The following
          are legal functions and their actions:

               SQRT  - computes square root
               LOG   - computes logarithm
               NLOG  - computes natural logarithm
               INT   - computes truncated integer
               ANINT - computes rounded integer
               ABS   - computes absolute value
               TAN   - computes tangent
               COS   - computes cosine
               SIN   - computes sine
               ATAN  - computes arctangent
               ACOS  - computes arccosine
               ASIN  - computes arcsine

          (operation)  is an optional modifying phrase which specifies the
          mathematical operation to be performed.  An operation requires two
          operands.  The available operations are listed below and must be
          typed exactly as specified to distinguish them from attributes and
          other phrases.  These operations are evaluated in order of prece-
          dence, with operators of equal precedence being evaluated from left
          to right.  Use of parentheses may override this order.  The legal
          phrases which may follow (operation) are: )  (map or value) 
          (function).  The following are legal operations and their actions:

               +    - performs addition
               -    - performs subtraction
               *    - performs multiplication
               /    - performs division
               **   - performs exponentiation
               MAXI - performs maximization (returns attribute of larger value)
               MINI - performs minimization (returns attribute of smaller value)
               COVE - performs covering (reproduces the values of the first
                      attribute, then replaces or covers them with the values
                      of the second attribute where that attribute is non-zero)
               AVER - performs averaging (returns the average of the two
                      attributes)

          (  is an optional modifying phrase which acts as a delimiter within
          a complex expression.  This phrase is valid to begin an expression.
          Each ( phrase used must be matched with a corresponding ) phrase.
          The legal phrases which may follow ( are:  (  (attribute or value)
          (function).

          )  is an optional modifying phrase which acts as a delimiter within
          a complex expression.  This phrase is valid to end an expression.
          Each ) phrase must be preceded by a corresponding ( phrase.  The le-
          gal phrases which may follow ) are:  )  (operation).


     The following are typical examples of valid COMPUTE commands:

          COMPUTE 7 AREA + ATT2 + 98.25 + SQRT ( ATT1 ) ,
          FOR NEWATT

          COMPUTE 3 SQRT ( LENGTH + ATT1 + ABS ( ATT2 ) ) * ,
          AVER ( ATT4 * ATT5 ) - ATT6 FOR NEWATT


     The limitations of the COMPUTE command are as follows:

          -- Phrases must be separated by one and only one blank.

          -- No more than 64 attributes may be input per use of the command.

          -- No more than 128 phrases may be contained in the mathematical
             expression.

          -- Attributes may not be named SQRT, LOG, NLOG, INT, ANINT, ABS, TAN,
             COS, SIN, ATAN, ACOS, ASIN, +, -, *, /, **, MAXI, MINI, COVE, or
             AVER.  Attributes may not begin with the characters AREA, PERI,
             or LENG.

          -- Must have write access to the multiple attribute file.
