Re: Regarding EVALUATE TRUE



<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.

The second way to do this is using EVALUATE ... ALSO.

EVALUATE WS-AGE ALSO WS-SEX ALSO WS-WEIGHT
WHEN 21 ALSO 'M' ALSO 150
PERFORM A-200-ACCEPT
WHEN OTHER
PERFORM A-300-DECLINE
END-EVALUATE.


In this example if WS-AGE is 21 AND WS-SEX is 'M' AND WS-WEIGHT is 150 then
PERFORM A-200-ACCEPT is executed, if not then PERFORM A-300-DECLINE is
executed.


You are trying to enforce a Top-Down approach to the Evaluate Verb when
there isn't one


.



Relevant Pages

  • 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 ... ORs in an EVALUATE statement as you would in an IF statement. ...
    (comp.lang.cobol)
  • 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)