View previous topic :: View next topic
|
Author |
Message |
Pons
New User
Joined: 25 May 2007 Posts: 61 Location: Coimbatore
|
|
|
|
Hi i want to know how the NOT will funtion in the below cobol statement.
IF CODE NOT = 'GMT' AND 'CST'
Compiler will treat as NOT = 'GMT' AND NOT = 'CST'
or else
NOT = 'GMT' AND TPO-POLSYM = 'CST'.
Please explain the NOT functionality clearly. |
|
Back to top |
|
|
Help-Me-Out
New User
Joined: 09 Dec 2006 Posts: 56 Location: Pune
|
|
|
|
pons,
when you use not equal then it applies to all the stmts to right side untill u dont code another qualifier.
in ur case to both the string
NOT = 'str1' and 'str2' implies
NOT = 'str1' and NOT = 'str2' |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
IF CODE NOT = 'GMT' AND 'CST' |
will work as described by Sandy.
Something you must be careful of is
Code: |
IF CODE NOT = 'GMT' OR 'CST' |
This code will always "fail". The NOT= condition will always be raised. |
|
Back to top |
|
|
noorkh
New User
Joined: 06 Mar 2006 Posts: 76 Location: Chennai
|
|
|
|
Dick,
I am not satisified that we can code single NOT value for both values as mentioned by Pons. I have tried it once it didn't work so i always used to put IF A NOT = 'I' AND A NOT = 'V'.
I may be wrong. Please clarify me. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Quote: |
I have tried it once it didn't work so i always used to put IF A NOT = 'I' AND A NOT = 'V'. |
How about trying it one more time? It will clear your doubt.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You might want to check if the one that did not work used OR rather than AND. . .
If you have one that will not work as you expect, please post it here. |
|
Back to top |
|
|
|