IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How 'NOT' operator will function in this statement


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Pons

New User


Joined: 25 May 2007
Posts: 61
Location: Coimbatore

PostPosted: Tue Sep 11, 2007 12:57 pm
Reply with quote

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
View user's profile Send private message
Help-Me-Out

New User


Joined: 09 Dec 2006
Posts: 56
Location: Pune

PostPosted: Tue Sep 11, 2007 1:11 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Sep 11, 2007 8:49 pm
Reply with quote

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
View user's profile Send private message
noorkh

New User


Joined: 06 Mar 2006
Posts: 76
Location: Chennai

PostPosted: Wed Sep 12, 2007 10:37 am
Reply with quote

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
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Sep 12, 2007 11:01 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 12, 2007 6:30 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Calling an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
No new posts Help on PL/I jsonPutValue function PL/I & Assembler 8
No new posts how to use Tso outtrap external function All Other Mainframe Topics 8
No new posts INSYNC option with same function as I... JCL & VSAM 0
Search our Forums:

Back to Top