Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us