OR


The OR statement adds a second or subsequent conditional check to a preceding statement, such as the series “IF A is true OR B is true, then...”. The OR statement itself compares the contents of two fields, or compares the contents of a field with a constant, to determine if a condition is true.

    ••••• OR       ••• •••••••••••••••••••••• ••• •• ••• •••••••••••••••••••••• •••
    (1)            (2) (3)                    (4) (5)(6) (7)                    (8)

(1) T/F execution conditions

(5) Relation (LT,GT,LE,GE,EQ,NE,IN,EX)

(2) 1st application ID

(6) 2nd application ID

(3) 1st field name or PDF

(7) 2nd field name, PDF, or constant

(4) 1st occurrence (constant/index)

(8) 2nd occurrence (constant/index)

Sets True/False Status Indicator

The OR statement may modify the current value of the next internal true/false status indicator. If the preceding statement is false and the OR statement is true, the current status of the next indicator is changed to T. See Using AND and OR Statements for more information.

Using the Statement

The OR statement specifies a relationship between two values. The valid relational operators are:

·    less than (LT), greater than (GT), less than or equal to (LE), greater than or equal to (GE)

·    equals (EQ), not equal to (NE), includes (IN), and excludes (EX).

The relation IN means “includes”. The relation is true if the value in the second field is included in the first field, and false otherwise. If the relation is true, the predefined field TEXT AT POSITION is set to the starting position of the second field within the first field. The first field must be an alpha field; the second can be either an alpha field or a constant. Trailing blanks are ignored if the second field is a constant; however, you may specify fixed spaces (by entering underscores) to include one or more trailing spaces as part of a character string that is being searched.

Normally, an OR statement is used immediately after an IF statement. However, the OR statement will operate successfully when used after any statement that sets the true/false status indicator. See AND and OR with Statements Other Than IF.

An OR statement may also be used in conjunction with one or more AND statements. For example:

          IF       A
          AND      B

          OR       C
          AND      D

Another example is:

          IF       A
          OR       B
          AND      C

          OR       D

Each of these examples could be expanded to add more AND and OR statements in various sequences but, no matter how many there are, the rules are always the same:

·    Each AND or OR statement performs only two checks at most: it checks the current value of the next true/false status indicator, and it evaluates its own condition. It does not matter how many statements preceded the AND/OR statement, nor what other statements follow the AND/OR statement.

·    If the current status of the next indicator is already false, the AND statement is bypassed since it is no longer relevant. If the current status is true and the AND statement is true, the current status is left unchanged as T. However, if the AND statement is false, the current status of the next indicator is changed to F.

·    Conversely, for an OR statement, if the current status of the next indicator is already true, the OR statement is bypassed since it is no longer relevant. If the current status is false and the OR statement is false, the current status is left unchanged as F. However, if the OR statement is true, the current status of the next indicator is changed to T.

Restrictions

The OR statement supports comparisons between like data types only (alpha-to-alpha, numeric-to-numeric, date-to-date, logic-to-logic). When comparing two date fields, results can be unpredictable if you are using a date field without a century component. Confirm that your System Administrator has set up the Pivot Year environment variable to avoid unexpected results.

Related PDFs

TEXT AT POSITION

Related Statements

AND, IF

Example

This example shows how to bypass statement processing if the customer is a miscellaneous customer or has a zero balance.

          IF       TAR CUSTOMER MISC CUSTOMER     EQ     1
          OR       TAR CUSTOMER BALANCE           EQ     0
    T     GOTO     :NO STATEMENT
          *
          *        (processing to print customer statements)
          *
          LABEL    :NO STATEMENT