Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Question on Evaluate Function in Cobol.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Amolondhe007
Warnings : 1

New User


Joined: 16 Apr 2007
Posts: 50
Location: Pune

PostPosted: Fri Mar 06, 2009 3:17 pm    Post subject: Question on Evaluate Function in Cobol.
Reply with quote

Hi,

Please let me know that Can we add AND Operator in Evaluate Function.

E.G.

Evaluate Color

When Red AND White * Here added AND Operator.

Display ' Good Combination '

When Other

Display ' No Combonation '

End-Evaluate.
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Mar 06, 2009 3:36 pm    Post subject:
Reply with quote

If you had looked at the EVALUATE statement, you would have seen that AND is not valid, ALSO is the way to join.....
Back to top
View user's profile Send private message
Amolondhe007
Warnings : 1

New User


Joined: 16 Apr 2007
Posts: 50
Location: Pune

PostPosted: Fri Mar 06, 2009 3:50 pm    Post subject: Reply to: Question on Evaluate Function in Cobol.
Reply with quote

Ok, William.

But if we are using any numeric value like
Code:
EVALUATE ANS 
WHEN 0.00 AND +64.00
      ADD +10.00 to +20.00 giving ANS.
      Display 'ANS: ' ANS.
WHEN OTHER
     Display 'INCORRECT VALUE'
END-EVALUATE.   



Then can it work?
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Mar 06, 2009 5:03 pm    Post subject:
Reply with quote

Hi Amol,

What you're looking for is "OR" capability. The "AND" as you explain it in your ex. is impossible.

You should use:
Code:
WHEN 0.00
WHEN +64.00
     ADD +10.00 to +20.00 giving ANS
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Fri Mar 06, 2009 8:44 pm    Post subject:
Reply with quote

EVALUATE TRUE
WHEN ANS = 0.00 OR +64.00
ADD +10.00 to +20.00 giving ANS.
Display 'ANS: ' ANS.
WHEN OTHER
Display 'INCORRECT VALUE'
END-EVALUATE.
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 205
Location: Bangalore

PostPosted: Fri Mar 06, 2009 9:00 pm    Post subject:
Reply with quote

Hi,

EVALUATE subject
WHEN object1
WHEN object2
END-EVALUATE

Datatypes of both subject and object should match. If subject is TRUE or FALSE, then object1 and object2 must be condition expressions which should evaluate to True or False. Note: These conditons can contain AND.


Thanks,
Ajay
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Mar 08, 2009 8:38 pm    Post subject:
Reply with quote

Hi Ajay,
Quote:
Note: These conditons can contain AND.

I know you made the above correct stmt as a general comment, but it may mislead in the context of Amol's ques:
Code:
WHEN 0.00 AND +64.00
     ADD +10.00 to +20.00 giving ANS.

"AND" cannot be both values simultaneously.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us