evaluate false, again



So I wrote some code yesterday using my wonderful new discovery of "evaluate
false". Here's the logic.

05 MSC-ISS-COUNTRY PIC 9(03).
88 ISS-COUNTRY-IS-USA VALUE 840.
05 MSC-ACQ-STATE PIC X(02).
88 NON-US-SURCHG-ALLOWED VALUES 'CO' 'CA'.

IF ICR-COUNTRY-CODE IS NUMERIC
MOVE ICR-COUNTRY-CODE TO MSC-ISS-COUNTRY
MOVE STR-REGE-ST TO MSC-ACQ-STATE
EVALUATE ISS-COUNTRY-IS-USA
OR NON-US-SURCHG-ALLOWED
WHEN FALSE
MOVE ZERO TO STR-SURCHG-AMT
MOVE 'N' TO STR-SURCHG-FLAG
END-EVALUATE
END-IF.


During peer code review the reviewer asserted that this would not work as
expected.
I then asked him if he believe that the following two sets of code were the
same as the first:

IF ICR-COUNTRY-CODE IS NUMERIC
MOVE ICR-COUNTRY-CODE TO MSC-ISS-COUNTRY
MOVE STR-REGE-ST TO MSC-ACQ-STATE
IF ISS-COUNTRY-IS-USA
OR NON-US-SURCHG-ALLOWED
CONTINUE
ELSE
MOVE ZERO TO STR-SURCHG-AMT
MOVE 'N' TO STR-SURCHG-FLAG
END-IF
END-IF.


IF ICR-COUNTRY-CODE IS NUMERIC
MOVE ICR-COUNTRY-CODE TO MSC-ISS-COUNTRY
MOVE STR-REGE-ST TO MSC-ACQ-STATE
EVALUATE ISS-COUNTRY-IS-USA
OR NON-US-SURCHG-ALLOWED
WHEN TRUE
CONTINUE
WHEN FALSE
MOVE ZERO TO STR-SURCHG-AMT
MOVE 'N' TO STR-SURCHG-FLAG
END-EVALUATE
END-IF.

He said he didn't believe so; that they were the same as each other but not
the same as the original. When asking why, it turns out he interpreted the
original kind of as the following:

IF ISS-COUNTRY-USA IS FALSE OR NON-US-SURCHG-ALLOWED IS FALSE
MOVE ZERO TO STR-SURCHG-AMT
MOVE 'N' TO STR-SURCHG-FLAG
END-IF

(Assume the above was valid Cobol, which of course it is not.)

I set him straight on how it works (it evaluates the expression, getting a
single true/false result, and then , but now my concern is that the original
statement is not as 'obvious' as I had first hoped.

(Of course there is the slight possibility that I am incorrect, but I did
test what I believe to be all possible cases and got the results I was
expecting.)

Opinions?

Frank



.