Re: IF statement, I don't understand this
- From: "HeyBub" <heybubNOSPAM@xxxxxxxxx>
- Date: Thu, 30 Mar 2006 10:36:04 -0600
Jack Benny wrote:
This is Unisys A-series C74,
I have
000600 01 SHH-SHIP-CODE PIC 9 VALUE 1.
000700 01 ASM010-I-DIR PIC X VALUE "R".
and
001000 IF SHH-SHIP-CODE = 5 AND ASM010-I-DIR = "L" OR "R" OR "S"
001100 DISPLAY "TRUE"
001200 ELSE
001300 DISPLAY "FALSE".
001400 ENDIF.
It comes up "TRUE" and I don't understand why. It doesn't seem right.
In this case, absent parens, the expression is evaluated pair-wise from left
to right.
SHH-SHIP-CODE = 5 AND ASM010-I-DIR = "L" evaluates as FALSE.
Then you have:
(FALSE) OR ASM010-I-DIR = "R" which evaluates as TRUE
Next you have:
(TRUE) OR ASM010-I-DIR = "S" which evaluates as TRUE
So, the whole expression is TRUE.
.
- References:
- IF statement, I don't understand this
- From: Jack Benny
- IF statement, I don't understand this
- Prev by Date: Re: IF statement, I don't understand this
- Next by Date: Re: IF statement, I don't understand this
- Previous by thread: Re: IF statement, I don't understand this
- Next by thread: Re: IF statement, I don't understand this
- Index(es):