Operators and expressions
Operators cause a CLIST to perform evaluations on data; the data
can be numeric or character, or can be a variable or a built-in function.
Operators fall into three categories: arithmetic, comparative, and
logical, as shown in Table 1.
- Arithmetic operators perform integer arithmeticon numeric operands. The operators connect integers, variables, orbuilt-in functions to form expressions, such as 4-2.
- Comparative operators perform comparisonsbetween
two expressions, to formcomparative
expressions, such as 4-2=3. The
=
is a comparative operator.The comparison produces a true or false condition. Comparative expressions are often used to determine conditional branching within a CLIST.
- Logical operators perform a logical comparison between the results
of two comparative expressions, to form logical expressions, such
as &A=4 AND &B=&C.The ‘AND’ is a logical operator.
Logical expressions produce true or false conditions. Logical expressions are often used to determine conditional branching within a CLIST.
In Table 1, if more than one accepted
value exists for an operator, the values are separated by commas.
For the function: | Enter: | |
---|---|---|
Arithmetic | Addition
Subtraction Multiplication Division Exponentiation Remainder Prioritization the order of evaluation |
+
- * / ** (See note 1) // () (See note 2) |
Comparative | Equal
Not equal Less than Greater than Less than or equal Not greater than Not less than |
=,EQ
¬=,NE <,LT >,GT <=,LE >=,GE ¬>,NG ¬<,NL |
Logical | And
Or |
AND,&&
OR,| |
Notes:
|
CLISTs try to perform evaluation wherever an operator is found, including the equal sign (=) in assignment statements. If you want CLISTs to treat operators as character data instead, use the &STR built-in function. For more information, see Defining character data - &STR.