Progress
Language Tutorial
for Windows


Using Operators

An operator is a language element that represents an action carried out on one or more operands, resulting in the return of a value. Operator categories include:

Numeric Operators

Use numeric operators with numeric data to perform calculations. Table 5–3 describes the operators.

Table 5–3: Numeric Operators 
Name
Operator
Description
Unary Negative
-
Reverses the sign of a numeric expression.
Variable1 = Credit-Limit.
Unary Positive
+
Preserves the positive or negative value of a numeric expression.
Credit-Limit = + (Credit-Limit - Balance).
Division
/
Divides one numeric expression by another numeric expression.
Variable1 = Extended-Price / Quantity.
Multiplication
*
Multiplies two numeric expressions.
Extended-Price = Price * Quantity.
Subtraction
-
Subtracts one numeric expression from another.
New-Price =
New-Price (Price * (Discount / 100)).
Addition
+
Adds two numeric expressions.
Balance = Balance + Variable1.

Comparison Operators

Use comparison operators to compare fields, variables, constants, or expressions. The result is always a logical value. Table 5–4 describes the comparison operators.

Table 5–4: Comparison Operators 
Name
Operator
Description
Less Than
<
or
LT
Returns TRUE if the first expression is less than the second.
FOR EACH Customer WHERE Balance LT Credit-Limit:
Less Than or Equal To
<=
or
LE
Returns TRUE if the first expression is less than or equal to the second.
FOR EACH Customer WHERE Balance LE Credit-Limit:
Greater Than
>
or
GT
Returns TRUE if the first expression is greater than the second.
FOR EACH customer WHERE balance > credit-limit:
Greater Than or Equal To
>=
or
GE
Returns TRUE if the first expression is greater than or equal to the second.
FOR EACH customer WHERE balance >= credit-limit:
Equal To
=
or
EQ
Returns TRUE if two expressions are equal.
FOR EACH customer WHERE country EQ "Finland":
Not Equal To
<>
or
NE
Returns TRUE if two expressions are not equal.
FOR EACH customer WHERE country <> "France":

Date Operators

You use date operators to manipulate date values. Table 5–5 describes the date operators.

Table 5–5: Date Operators 
Name
Operator
Description
Date Subtraction
-
Subtracts a number of days from a date to produce a date result, or subtracts one date from another to produce an integer result that represents the number of days between the two dates.
days-over = ship-date promise-date.
Date Addition
+
Adds a number of days to a date to produce a date result.
due-date = invoice-date + 30.

Character Operator

You use the character concatenation operator to combine two character expressions. Table 5–6 describes the operator.

Table 5–6: Character Operator 
Name
Operator
Description
Concatenation
+
Produces a character value by joining, or concatenating, two character strings or expressions.
DISPLAY "ATTN: " + contact.

Logical Operators

The logical operators allow you to make compound Boolean conditions. Table 5–7 describes the logical operators.

Table 5–7: Logical Operators 
Operator
Description
NOT
Returns a TRUE value if an expression is false, and FALSE if an expression is true.
IF NOT AVAILABLE customer THEN DO:
AND
Returns a TRUE value if all expressions are true.
FOR EACH customer WHERE balance LE credit-limit AND country = "Japan":
OR
Returns a TRUE value if at least one expression is true.
FOR EACH customer WHERE balance > credit-limit OR credit-limit > 50000:


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095