View previous topic :: View next topic |
Author |
Message |
ravii_cbe Beginner
Joined: 28 Mar 2003 Posts: 6 Topics: 5 Location: Chennai
|
Posted: Wed Apr 30, 2003 6:20 am Post subject: Difference b/w EVALUATE AND & also |
|
|
What is the difference b/w EVALUATE (A AND B) Vs EVALUATE (A Also B).
When I tried EVALUATE (A also B) also C . I didn't get compile time error. when I use AND instead of AND i got compiling error. Is it the difference b/w these two?
From
Ravi _________________ Thanks & Regards
M. RaviShankar |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Wed Apr 30, 2003 6:37 am Post subject: |
|
|
Its just syntax. 'Also' is allowed and 'And' is not. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Fri May 02, 2003 1:24 pm Post subject: |
|
|
Some don't cotton to the ALSO approach. They see it as obscure and misleading. If you feel the same way you can try the following, it gives the "effect" of an AND:
EVALUATE TRUE
WHEN WS-A = x AND WS-B = y
blah, blah, blah1
WHEN WS-A = x OR WS-B = y
blah, blah, blah2
END-EVALUATE
In fact, any valid conditional expression, simple or complex, can be used.
Jack |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Thu May 15, 2003 12:37 am Post subject: |
|
|
Though it might be slower but I myself prefer 'EVALUATE TRUE' because it is very easy to add a new condition while modification. Say, in slade's example, I can easily add "WHEN WS-C = 'Z'".
Since we don't have Else-If in Cobol so I even prefer using Evaluate instead of If because there is always a chance that your analysis was wrong and you need to next few more Ifs in the earlier If. And then it becomes very unreadable.
Dibakar. |
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Sun May 18, 2003 12:40 am Post subject: |
|
|
I like to alternate IFs and EVALs. I seems to "read" better. Fer instance:
IF FLD-A = 1
IF FLD-B = 46
do this....
IF FLD-A = 1
EVALUATE FLD-B
WHEN 46
do this....
I don't know, it just seems to flow better. This is the way I'd present the idea to the reader if we were talking face to face. |
|
Back to top |
|
|
|
|