Operators

There are four types of operators:

Arithmetic

Arithmetic operators operate on integer constants, integer variables, and integer expressions.

Comparison

Binary comparison operators compare two integer operands or two strings. The result of a comparison operation is zero if the condition is false; it is nonzero if the condition is true.

The unary comparison operator (?) checks for the existence of a member in a variable group.

An entire expression is evaluated even if it is found to be false before the evaluation is completed.

Boolean

Boolean operators perform the following logical operations:

The result of a Boolean operation is zero if the result is false and is nonzero if the result is true.

Conversion

The following conversions are allowed:

Supported AMS Operators

Table 5–1 lists the operators supported by AMS.

Table 15. Supported AMS Operators

Operator

Action

Unary negation

+

Unary positive

!

Unary logical NOT

?

Tests for the existence of a member in a variable group

#

Converts a string operand to an integer operand

^

Converts the lowercase letters in a string operand to uppercase equivalents

*

Multiplication

/

Integer division

%

Integer remainder

+

Addition

Subtraction

<

Less than

>

Greater than

<=

Less than or equal to

>=

Greater than or equal to

=

Equal to

!=

Not equal to

&

Logical AND

|

Logical OR


Rules for Using Comparison Operators

The following rules apply when using comparison operators in strings:

Precedence of Operators

Table 5–2 shows the precedence of operators. The list is in sequence of highest to lowest precedence. Where several operators are grouped, they are treated without precedence and evaluated from left to right. To change the order of precedence, enclose operands and operators within parentheses [( )].

Table 16. Precedence of Operators

Evaluation Sequence

Operators

First

— (unary) + (unary)  !  ?  #  ^  

Second

*    /    %

Third

+ (binary)    ─ (binary)

Fourth

<    >    <=    >=

Fifth

=    !=

Sixth

&

Last


Example

The following example shows an expression that adds one to the value of the member named by _TOKEN3 of the variable group UserErrors:

UserErrors:_TOKEN3 + 1