Logical

A logical expression (logical_expr), when evaluated, produces a result of type logical. The form of a logical expression is:
Read syntax diagramSkip visual syntax diagram
>>-+-----------------------------+--logical_disjunct-----------><
   '-logical_expr--+-.EQV.-----+-'                     
                   +-.NEQV.----+                       
                   |       (1) |                       
                   '-.XOR.-----'                       

Notes:
  1. XL Fortran logical operator
The form of a logical_disjunct is:
Read syntax diagramSkip visual syntax diagram
>>-+------------------------+--logical_term--------------------><
   '-logical_disjunct--.OR.-'                 

The form of a logical_term is:
Read syntax diagramSkip visual syntax diagram
>>-+---------------------+--logical_factor---------------------><
   '-logical_term--.AND.-'                   

The form of a logical_factor is:
Read syntax diagramSkip visual syntax diagram
>>-+--------------------------------+--------------------------><
   '-+-------+--+-logical_primary-+-'   
     '-.NOT.-'  '-rel_expr--------'     

logical_primary is a primary of type logical.

rel_expr is a relational expression.

The logical operators are:

Logical Operator Representing Precedence
.NOT. Logical negation First (highest)
.AND. Logical conjunction Second
.OR. Logical inclusive disjunction Third
.XOR.  1  Logical exclusive disjunction Fourth (lowest)
.EQV. Logical equivalence Fourth (lowest)
.NEQV. Logical nonequivalence Fourth (lowest)
Note:
  1. XL Fortran logical operator.

IBM extension begins The .XOR. operator is treated as an intrinsic operator only when the -qxlf77=intxor compiler option is specified. (See the -qxlf77 option in the XL Fortran Compiler Reference for details.) Otherwise, it is treated as a defined operator. If it is treated as an intrinsic operator, it can also be extended by a generic interface. IBM extension ends

The precedence of the operators determines the order of evaluation when a logical expression containing two or more operators having different precedences is evaluated. For example, evaluation of the expression A.OR.B.AND.C is the same as evaluation of the expression A.OR.(B.AND.C).



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us