MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Condition checking using NOT

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
adarsh444
Beginner


Joined: 19 Sep 2006
Posts: 13
Topics: 9

PostPosted: Wed Mar 07, 2007 3:07 am    Post subject: Condition checking using NOT Reply with quote

I am not getting any error for the below condition
but this condition check fails.
Is not and or are not valid together.
Code:

IF WS1-SERVICE-NAME NOT = SPACES OR LOW-VALUES  THEN       
   MOVE WS-ERRROR              TO WS1-SCREEN             
END-IF
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Mar 07, 2007 6:28 am    Post subject: Reply with quote

adarsh444,

Code:

a.         IF NOT (condition-1 OR condition-2)

                                    is equivalent to

            IF NOT condition-1 AND NOT condition-2

 

b.         IF NOT (condition-1 AND condition-2)

                                    is equivalent to

            IF NOT condition-1 OR NOT condition-2

 

The hierarchy rules for statements that include negated conditionals are:

a.         NOT is evaluated first.

b.         AND (from left to right) is evaluated next.

c.         OR (from left to right) is evaluated last.

d.         Parentheses override the other hierarchy rules.  All conditions within parentheses are evaluated first.



Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
samlwho
Beginner


Joined: 08 Feb 2007
Posts: 21
Topics: 2

PostPosted: Fri Mar 09, 2007 10:58 am    Post subject: Reply with quote

IF WS1-SERVICE-NAME NOT = SPACES OR LOW-VALUES THEN
MOVE WS-ERRROR TO WS1-SCREEN
END-IF

Here is how I would write it:

IF WS1-SERVICE-NAME = SPACES OR LOW-VALUES
-----NEXT SENTENCE
ELSE
-----MOVE WS-ERRROR TO WS1-SCREEN
END-IF

...I try to avoid using NOT's as they can cause confusion.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Sat Mar 10, 2007 11:28 am    Post subject: Reply with quote

samlwho,
if you are a 1 period per paragraph man, like myself, you might want to use CONTINUE instead of NEXT SENTENCE.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group