# Expression Operators

There are several types of operations:

Unary Operations
Unary operations are coded by specifying the operator followed by one operand. The unary operators are:
+
The unary plus operation maintains the value of the numeric operand.
-
The unary minus operation negates the value of the numeric operand. For example, if NUMBER has the value 123.4, the value of -NUMBER is -123.4.
NOT
The logical negation operation returns '1' if the value of the indicator operand is '0' and '0' if the indicator operand is '1'. Note that the result of any comparison operation or operation AND or OR is a value of type indicator.
Binary Operations
Binary operations are coded by specifying the operator between the two operands. The binary operators are:
+
The meaning of this operation depends on the types of the operands. It can be used for:
2. Adding a duration to a date, time, or timestamp.
3. Concatenating two character, two graphic, or two UCS-2 values
4. Adding a numeric offset to a basing pointer
5. Combining a date and a time to yield a timestamp
-
The meaning of this operation depends on the types of the operands. It can be used for:
1. Subtracting two numeric values
2. Subtracting a duration from a date, time, or timestamp.
3. Subtracting a numeric offset from a basing pointer
4. Subtracting two pointers
*
The multiplication operation is used to multiply two numeric values.
/
The division operation is used to divide two numeric values.
**
The exponentiation operation is used to raise a number to the power of another. For example, the value of 2**3 is 8.
=
The equality operation returns '1' if the two operands are equal, and '0' if not.
<>
The inequality operation returns '0' if the two operands are equal, and '1' if not.
>
The greater than operation returns '1' if the first operand is greater than the second.
>=
The greater than or equal operation returns '1' if the first operand is greater or equal to the second.
<
The less than operation returns '1' if the first operand is less than the second.
<=
The less than or equal operation returns '1' if the first operand is less or equal to the second.
AND
The logical and operation returns returns '1' if both operands have the value of indicator '1'.
OR
The logical or operation returns returns '1' if either operand has the value of indicator '1'.
IN
The IN operation returns returns '1' if the first operand is equal to an element of the second operand or if the first operand is in the range specified by the second operand.
Assignment Operations
Assignment operations are coded by specifying the target of the assignment followed by an assignment operator followed by the expression to be assigned to the target. Compound-assignment operators of the form op= (for example +=) combine assignment with another operation, using the target as one of the operands of the operation. The = assignment operator is used with the EVAL and EVALR operations. The op= compound-assignment operators are used with the EVAL operation only. The assignment operators are:
• = The expression is assigned to the target
• += The expression is added to the target
• -= The expression is subtracted from the target
• *= The target is multiplied by the expression
• /= The target is divided by the expression
• **= The target is assigned the target raised to the power of the expression
Built-In Functions
Built-in functions are discussed in Built-in Functions.
User-Defined Functions
Any prototyped procedure that returns a value can be used within an expression. The call to the procedure can be placed anywhere that a value of the same type as the return value of the procedure would be used. For example, assume that procedure MYFUNC returns a character value. The following shows three calls to MYFUNC: