Re: Regarding EVALUATE TRUE



In article <5ij909F3q823gU1@xxxxxxxxxxxxxxxxxx>, "Pete Dashwood" <dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:


"me" <null@xxxxxxxx> wrote in message
news:376dncyji7pZ_l7bnZ2dnUVZ8qydnZ2d@xxxxxxxxx
<klshafer@xxxxxxx> wrote in message
news:1187204587.545493.218790@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<major snippage>

That's why you have examples like these (from
http://www.damos.dircon.co.uk/html/cobol_evaluate_verb.html):

Sometimes you will want to have multiple conditions with lots of ANDs and
ORs in an EVALUATE statement as you would in an IF statement. To do this
with EVALUATE requires a slightly different approach. One way is to use
EVALUATE TRUE (or EVALUATE FALSE). for example

EVALUATE TRUE
WHEN WS-X = 1 AND WS-Y = 2
PERFORM X-100-PROCESS1
WHEN WS-X =1 AND WS-Y NOT = 2
PERFORM X-200-PROCESS2
END-EVALUATE.

Here, the whole condition on the WHEN statement is checked and if it is
TRUE then the associated statement(s) are executed.

You could completely eradicate all Boolean conjunctions from the above if
you weren't so Hell-bent on using EVALUATE :-)

IF WS-X = 1
IF WS-Y = 2
PERFORM X-100-PROCESS1
ELSE
PERFORM X-200-PROCESS2
END-IF
END-IF

Arguably less cluttered than the EVALUATE, and certainly less typing... :-)

And far, far easier to understand, too.

--
Regards,
Doug Miller (alphageek at milmac dot com)

It's time to throw all their damned tea in the harbor again.
.



Relevant Pages

  • Re: Regarding EVALUATE TRUE
    ... Sometimes you will want to have multiple conditions with lots of ANDs and ... ORs in an EVALUATE statement as you would in an IF statement. ...
    (comp.lang.cobol)
  • Re: Regarding EVALUATE TRUE
    ... Pete Dashwoodwrote: ... Sometimes you will want to have multiple conditions with lots of ANDs ...
    (comp.lang.cobol)
  • Re: Regarding EVALUATE TRUE
    ... Pete Dashwoodwrote: ... Sometimes you will want to have multiple conditions with lots of ANDs ...
    (comp.lang.cobol)
  • Re: Regarding EVALUATE TRUE
    ... Pete Dashwoodwrote: ... Sometimes you will want to have multiple conditions with lots of ANDs ...
    (comp.lang.cobol)
  • Re: Regarding EVALUATE TRUE
    ... Sometimes you will want to have multiple conditions with lots of ANDs and ... You are trying to enforce a Top-Down approach to the Evaluate Verb when ...
    (comp.lang.cobol)