Numeric data, string data, and the null value can function as logical data. Numeric and string data can have a logical value of true or false. The numeric value 0 (zero), is false; all other numeric values are true. Character string data other than an empty string is true; an empty string is false. The null value is neither true nor false. It has the special logical value of null.
Logical operators perform tests on logical expressions. Logical expressions that evaluate to zero or an empty string are false. Logical expressions that evaluate to null are null. Expressions that evaluate to any other value are true.
The logical operators in InfoSphere® DataStage® BASIC are:
The NOT function inverts a logical value.
The operands of the logical operators are considered to be logical data types. Tables Table 1, Table 2, and Table 3 show logical operation results.
| AND | TRUE | NULL | FALSE |
|---|---|---|---|
| TRUE | TRUE | NULL | FALSE |
| NULL | NULL | NULL | FALSE |
| FALSE | FALSE | FALSE | FALSE |
| OR | TRUE | NULL | FALSE |
|---|---|---|---|
| TRUE | TRUE | TRUE | TRUE |
| NULL | TRUE | NULL | NULL |
| FALSE | TRUE | NULL | FALSE |
| NOT | ||
|---|---|---|
| TRUE | FALSE | |
| NULL | NULL | |
| FALSE | TRUE |
Arithmetic and relational operations take precedence over logical operations. InfoSphere DataStage logical operations are evaluated from left to right (AND statements do not take precedence over OR statements).