Re: IF statement, I don't understand this
- From: "Oliver Wong" <owong@xxxxxxxxxxxxxx>
- Date: Thu, 30 Mar 2006 15:01:28 GMT
"Steve Rainbird" <news.nospam@xxxxxxxxxxxxxxxxxxxxx> wrote in message news:4922pkFlplp7U1@xxxxxxxxxxxxxxxxx
"Jack Benny" <pkline@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:2akn2295mqoqg2hok7b2vs96okhdug438a@xxxxxxxxxxThis 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.
Its because AND is evaluated before OR.
So effectively your statements is doing this
IF (SHH-SHIP-CODE = 5 AND ASM010-I-DIR = "L") OR (ASM010-I-DIR ="R") OR (ASM010-I-DIR ="S")
What you want is
IF SHH-SHIP-CODE = 5 AND (ASM010-I-DIR = "L" OR "R" OR "S"
Seriously?
Damn, I'm not sure if my COBOL parser handles this case correctly, then... Abbreviated conditionals are a real pain...
- Oliver
.
- References:
- IF statement, I don't understand this
- From: Jack Benny
- Re: IF statement, I don't understand this
- From: Steve Rainbird
- IF statement, I don't understand this
- Prev by Date: Re: CICS DOCUMENT CREATE storage?
- 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):