Open ypj0202 opened 5 months ago
If I understand it correctly, you might be overthinking it. EVALUATE
just matches one expression given in its header with one expression given in the WHEN
clause (or two or more, one by one, in case of ALSO
).
So if you start with EVALUATE X + 1 ALSO Y + 2
, both expressions evaluate to two decimals, so you should also match them with two decimals. For instance, WHEN 10 ALSO 42
, without any mentioning of X
s and Y
s.
Conversely, when you do EVALUATE X = 1 ALSO Y = 10
, both are Booleans, so inside this block there should be things like WHEN TRUE ALSO FALSE
.
Another idiomatic commonly encountered pattern in real COBOL code is EVALUATE TRUE
which allows you to basically collect together any kinds of Boolean expressions in different WHEN
s of the same EVALUATE
. That's where you go WHEN X>10
and WHEN Y < 0
, etc.
You don't need to worry about contracted expressions here.
Ah, that makes sense. Now I am wondering what are you expecting for the contracted expression of EVALUATE
and WHEN
?
If I understand correctly, for
EVALUATE
clause and contracted expression for that it should support the following: For regularEVALUATE
:For contracted expression
My questions:
1) Is my intuition for the logic of
EVALUATE
right? 2) How should I deal in case of the following:Also, the example you give in another discussion: