GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Mainframe  >  COBOL
Go To First  |  Previous Question  |  Next Question 
 COBOL  |  Question 79 of 162    Print  
What is the use of evaluate statement give example?

  
Total Answers and Comments: 3 Last Update: November 27, 2006     Asked by: Namash 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
October 16, 2006 01:24:45   #1  
ajay s baghel        

RE: what is the use of evaluate statment give eg

When we have to resort to different actions depending on the value of a variable: we can use Evaluate-endevaluate. It is just like Switch case in C language.

Eg:

move '12' to Month.

evaluate Month

when '12' display 'you are right'

when '01' display 'it is not new year dear!'

when other display 'try again Boy!'

end-evaluate.

So it will display three different strings depending on what is moved into the variable Month.


 
Is this answer useful? Yes | No
October 17, 2006 04:19:05   #2  
Max        

RE: what is the use of evaluate statment give eg

In short evaluate is a replacement of nested-if.

If 1+1>2 then display '1+1>2 is wrong'

else if 1+1<2 then display '1+1<2 is wrong too'

else display 'you are right'

end-if

end-if

could be replaced by:

evaluate true

when 1+1>2 display '1+1>2 is wrong'

when 1+1<2 display '1+1<2 is wrong too'

when other display 'you are right'

end-evaluate.


 
Is this answer useful? Yes | No
November 27, 2006 00:12:18   #3  
susi        

RE: what is the use of evaluate statment give eg

The Evaluate statement can be used in replacement of Nested-IF statements. These are also potentially used by combining the logical operators.

FOR EG:

evaluate a > 100 and a < 500

move 'good' to b

evaluate a > 500 or a < 1000

move 'better' to b

evaluate a > 1000 or a < 5000

move 'best' to b

end-evaluate.


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape