Don't know if this is the right place to ask ...
after 25 years playing with other languages like PL/1, C and ASSEMBLER,
I have now to work with COBOL again. Took me some time to get started,
because my COBOL knowledge was at a, say, 1970s level :-)
Now I am in the 4th month of my assignment, and I feel more secure with
such things like EVALUATE, inline PERFORM, SEARCH etc. etc. (avoiding GO
TOs
most of the time).
But today I had a strange experience with the following (not so
complicated)
IF condition:
IF (TVOLL (IND1) NOT = HIGH-VALUE)
AND (SMOD (IND1) = 'B' OR 'R')
I first coded it without the parantheses and it did not work ...
IF TVOLL (IND1) NOT = HIGH-VALUE
AND SMOD (IND1) = 'B' OR 'R'
the first part of the condition was false (TVOLL ... was HIGH-VALUE
indeed),
and so I hoped that the combined condition would be false, although SMOD
... was R.
But: nope.
This must be a misunderstanding at my part, what the abbreviation ... OR
'R' ...
means in this case. Maybe in combination with the AND.
Could someone please explain the rules or give any hint? Of course, it
is always
a good idea to use parantheses, when in doubt. But I really thought that
it would
be ok without parantheses in this case ... what is the problem here, and
what are
the semantics in the variant without parantheses?
Thanks, kind regards
Bernd
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN