Re: Regarding EVALUATE TRUE
- From: spambait@xxxxxxxxxx (Doug Miller)
- Date: Thu, 16 Aug 2007 16:40:36 GMT
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.
.
- References:
- Regarding EVALUATE TRUE
- From: klshafer@xxxxxxx
- Re: Regarding EVALUATE TRUE
- From: me
- Re: Regarding EVALUATE TRUE
- From: Pete Dashwood
- Regarding EVALUATE TRUE
- Prev by Date: Re: Regarding EVALUATE TRUE
- Next by Date: Re: Regarding EVALUATE TRUE
- Previous by thread: Re: Regarding EVALUATE TRUE
- Next by thread: Re: Regarding EVALUATE TRUE
- Index(es):
Relevant Pages
|