EVALUATE MULTIPLE CONDITION and SINGLE CONDITION



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

EVALUATE MULTIPLE CONDITION and SINGLE CONDITION

Postby yogeshvalhe » Fri Sep 28, 2012 3:14 am

Hello,

I had a question on EVALUATE statement. I am aware that, there can be multiple condition check in WHEN clause with usage of ALSO verb.

My question is that, I have a requirement in WHEN clause, I want to compare single and multiple conditions single EVALUATE statement.
E.g.
EVALUATE TRUE
WHEN A
MOVE 'AAAA' TO OUT-PUT
WHEN A ALSO B
MOVE 'AABB' TO OUT-PUT
WHEN A ALSO D
MOVE 'AADD' TO OUT-PUT
WHEN B ALSO D
MOVE 'BBDD' TO OUT-PUT
WHEN OTHER
MOVE 'OTHER' TO OUT-PUT
END-EVALUATE.

So, my question is, can we have WHEN condition for single comparison and multiple comparison. (actually, I have coded like this, but its not working, may I am doing something wrong or it is not possible)

can someone suggest to handle the situation above. Thank you for your help.

Tks, YV
yogeshvalhe
 
Posts: 22
Joined: Wed Aug 18, 2010 3:32 pm
Has thanked: 0 time
Been thanked: 0 time

Re: EVALUATE MULTIPLE CONDITION and SINGLE CONDITION

 

Re: EVALUATE MULTIPLE CONDITION and SINGLE CONDITION

Postby BillyBoyo » Fri Sep 28, 2012 3:44 am

Suggest you check in the Language Reference. You'll need TRUE ALSO TRUE on the EVALUATE, you'll also have to be very careful of the order. Your WHEN A ALSO B and A ALSO D will never be true, because you've already got WHEN A (for which you'll need ALSO ANY).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post