View previous topic :: View next topic |
Author |
Message |
adarsh444 Beginner
Joined: 19 Sep 2006 Posts: 13 Topics: 9
|
Posted: Wed Mar 07, 2007 3:07 am Post subject: Condition checking using NOT |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Mar 07, 2007 6:28 am Post subject: |
|
|
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 |
|
 |
samlwho Beginner
Joined: 08 Feb 2007 Posts: 21 Topics: 2
|
Posted: Fri Mar 09, 2007 10:58 am Post subject: |
|
|
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 |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Sat Mar 10, 2007 11:28 am Post subject: |
|
|
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 |
|
 |
|
|