Logical Expressions

A logical expression contains logical and relational operators and is evaluated to a value that is true or false.

Forming a Logical Expression

This example shows various elements that are used to form a logical expression. The abbreviation exp stands for expression.

{arithmetic exp|alphanumeric exp} operator1

 {numeric lit|alphanumeric lit} OR...

 expressionoperator2expressionlogical exp {AND|OR} logical exp 

 NOT logical exp

where:

operator1

Is one of the following: EQ, NE, OMITS, or CONTAINS.

expression

Is either an arithmetic, alphanumeric, or logical expression.

operator2

Is one of the following: EQ, NE, LE, LT, GE, or GT.

The following table defines valid operators (EQ, NE, and so on) used in this example.

Operator

Description

EQ

Tests for a value equal to another value.

NE

Tests for a value not equal to another value.

OMITS

Tests for a value that does not contain a matching character string.

CONTAINS

Tests for a value that does contain a matching character string.

LE

Tests for a value less than or equal to another value.

LT

Tests for a value less than another value.

GE

Tests for a value greater than or equal to another value.

GT

Tests for a value greater than another value.

AND

Returns a value of true if both of its operands are true.

OR

Returns a value of true if either of its operands is true.

NOT

Returns a value of true if the operand is false.