6.5 Conditions

There are four types of conditions that could be tested either in a PERFORM, IF..THEN, or EVALUATE (see next section), these being:

	1. Class conditions
	2. Relational conditions
	3. Sign conditions
	4. Condition-name conditions
Class conditions test where an item is NUMERIC, ALPHABETIC, ALPHABETIC-LOWER, or ALPHABETIC-HIGHER (as in lower or upper case).

Relational conditions allow comparisons, i.e: GREATER THAN, LESS THAN, EQUAL TO or their sign equivalent:  " > ", " respectively.

Sign conditions test whether an item IS POSITIVE, IS NEGATIVE, or IS NOT ZERO. (note 'IS' is optional)

Condition-name conditions are as described in the Defining data (part 2) section, where a named condition is defined in the data division using a level 88 description.

Conditions can be combined using AND, OR, AND NOT, OR NOT, and brackets. The most common combinations would probably be GREATER THAN OR EQUAL TO and LESS THAN OR EQUAL TO, which can simply be written >= and respectively. Also, NOT EQUAL TO would be although I find the Fujitsu compiler rejects '' so I just use 'NOT = ' instead.

More complex combinations can be acheived with the use of brackets. eg.

   IF ( X > Y ) AND ( ( Y + 10  Z ) ) THEN ...

  [true] AND [false] = FALSE
  [true] AND [true]  = TRUE
  [true] OR [false]  = TRUE
  [true] OR [true]   = TRUE
         NOT [true]  = FALSE
         NOT [false] = TRUE

Alpha-numeric comparisons can also be made that relate to their ASCII character value, so 'A' The SET verb is quite useful when working with boolean items and has been discussed in the previous section.