Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

X 6.1.6.11.1 Using Parentheses




X You can use parentheses in combined relation conditions to specify an
X intended order of evaluation. Using parentheses can also help you to
X improve the readability of conditional expressions.


X The following rules govern the use of parentheses in abbreviated combined
X relation conditions:

  1. X Parentheses can be used to change the order of evaluation of the
    X logical operators AND and OR.
    
    
  2. X The word NOT participates as part of the relational operator when it
    X is immediately followed by GREATER THAN, >, LESS THAN, <, EQUAL TO,
    X and =.
    
    
  3. X NOT in any other position is considered a logical operator and thus
    X results in a negated relation-condition. If you use NOT as a logical
    X operator, only the relation condition immediately following the NOT is
    X negated; the negation is not propagated through the abbreviated
    X combined relation condition along with the subject and relational
    X operator.
    
    
  4. X The logical NOT operator can appear within a parenthetical expression
    X that immediately follows a relational operator.
    
    
  5. X When a left parenthesis appears immediately after the relational
    X operator, the relational operator is distributed to all objects
    X enclosed in the parentheses. In the case of a "distributed"
    X relational operator, the subject and relational operator remain
    X current after the right parenthesis which ends the distribution. The
    X following three restrictions apply to cases where the relational
    X operator is distributed throughout the expression:
    
    
    1. X A simple condition cannot appear within the scope of the
      X distribution.
    2. X Another relational operator cannot appear within the scope of the
      X distribution.
    3. X The logical operator NOT cannot appear immediately after the left
      X parenthesis, which defines the scope of the distribution.
      
      
  6. X Evaluation proceeds from the least to the most inclusive condition.
    
    
  7. X There must be a one-to-one correspondence between left and right
    X parentheses, with each left parenthesis to the left of its
    X corresponding right parenthesis. If the parentheses are unbalanced,
    X the compiler inserts a parenthesis and issues an E-level message.
    X Note, however, that if the compiler-inserted parenthesis results in
    X the truncation of the expression, you will receive an S-level
    X diagnostic message.
    
    
  8. X The last stated subject is inserted in place of the missing subject.
    
    
  9. X The last stated relational operator is inserted in place of the
    X missing relational operator.
    
    
  10. X Insertion of the omitted subject and/or relational operator ends when:
    
    
    1. X Another simple condition is encountered,
    2. X A condition-name is encountered,
    3. X A right parenthesis is encountered that matches a left parenthesis
      X that appears to the left of the subject.
      
      
  11. X In any consecutive sequence of relation conditions, you can use both
    X abbreviated relation conditions that contain parentheses and those
    X that don't.
    
    
  12. X Consecutive logical NOT operators cancel each other and result in an
    X S-level message. Note, however, that an abbreviated combined relation
    X condition can contain two consecutive NOT operators when the second
    X NOT is part of a relational operator. For example, you can abbreviate
    X the first condition as the second condition listed below.
    
    
    
     X       A = B and not A not = C
     X       A = B and not not = C
    


X The following table summarizes the rules for forming an abbreviated
X combined relation condition.


RevisionX  Table 30. Abbreviated Combined Conditions--Permissible Element Sequences  
RevisionX  Combined   
RevisionX  Condition  
RevisionX  Element    
RevisionX        
RevisionX  Left  
RevisionX  most  
RevisionX  When not leftmost,    
RevisionX  can be immediately    
RevisionX  preceded by:          
RevisionX        
RevisionX  Right 
RevisionX  most  
RevisionX  When not rightmost,  
RevisionX  can be immediately   
RevisionX  followed by:         
RevisionX  Subject     RevisionX  Yes    RevisionX  NOT (                  RevisionX  No     RevisionX  Relational operator  
RevisionX  Object     
RevisionX             
RevisionX  No    
RevisionX        
RevisionX  Relational operator   
RevisionX  AND OR NOT (          
RevisionX  Yes   
RevisionX        
RevisionX  AND OR )             
RevisionX                       
RevisionX  Relational 
RevisionX  operator   
RevisionX  No    
RevisionX        
RevisionX  Subject AND OR NOT    
RevisionX                        
RevisionX  No    
RevisionX        
RevisionX  Object (             
RevisionX                       
RevisionX  AND OR     
RevisionX             
RevisionX  No    
RevisionX        
RevisionX  Object )              
RevisionX                        
RevisionX  No    
RevisionX        
RevisionX  Object Relational    
RevisionX  operator NOT (       
RevisionX  NOT        
RevisionX             
RevisionX             
RevisionX  Yes   
RevisionX        
RevisionX        
RevisionX  AND OR (              
RevisionX                        
RevisionX                        
RevisionX  No    
RevisionX        
RevisionX        
RevisionX  Subject Object       
RevisionX  Relational operator  
RevisionX  (                    
RevisionX  (          
RevisionX             
RevisionX  Yes   
RevisionX        
RevisionX  Relational operator   
RevisionX  AND OR NOT (          
RevisionX  No    
RevisionX        
RevisionX  Subject Object NOT ( 
RevisionX                       
RevisionX  )           RevisionX  No     RevisionX  Object )               RevisionX  Yes    RevisionX  AND OR )             


The following examples illustrate abbreviated combined relation conditions, with and without parentheses, and their unabbreviated equivalents.


 Table 31. Abbreviated Combined Conditions--Unabbreviated Equivalents      
 Abbreviated Combined Relation       
 Condition                           
 Equivalent                          
                                     
 A = B AND NOT < C OR D              
                                     
 ((A = B) AND (A NOT < C))  OR (A    
 NOT < D)                            
 A NOT > B OR C                        (A NOT > B)  OR (A NOT > C)         
 NOT A = B OR C                        (NOT (A = B)) OR (A = C)            
RevisionX  NOT (A = B OR < C)                   RevisionX  NOT ((A = B) OR (A < C))            
RevisionX  NOT (A NOT = B AND C AND NOT D)     
RevisionX                                      
RevisionX  NOT ((((A NOT = B) AND (A NOT = C)) 
RevisionX   AND (NOT (A NOT = D))))            




Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.