IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

what is the disadvantage of evaluate verb


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anujageorge

New User


Joined: 28 Mar 2007
Posts: 4
Location: Cochin

PostPosted: Mon Jun 11, 2007 2:42 pm
Reply with quote

hi ,

plz tell what is the advantage and disadvantage of evaluate verb
Back to top
View user's profile Send private message
munikumar
Currently Banned

New User


Joined: 18 Apr 2007
Posts: 24
Location: India

PostPosted: Mon Jun 11, 2007 2:46 pm
Reply with quote

EVALUATE is the case statement in COBOL.

You can validate a condition with multiple checkings. It will give you a cleare picture and more understandability. There are number of EVALUATE syntaxes that we can use.

For example,

EVALUATE TRUE
WHEN <condition1>
statement-1s
WHEN <condition2>
statement-2s
.
.
WHEN OTHER
statement-os
END-EVALUATE.
Back to top
View user's profile Send private message
anujageorge

New User


Joined: 28 Mar 2007
Posts: 4
Location: Cochin

PostPosted: Mon Jun 11, 2007 2:49 pm
Reply with quote

what is its disadvantage
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Mon Jun 11, 2007 2:52 pm
Reply with quote

What makes you think there is a disadvantage?
Back to top
View user's profile Send private message
gauravgupta2808
Warnings : 1

New User


Joined: 31 May 2007
Posts: 31
Location: Chennai, India

PostPosted: Mon Jun 11, 2007 2:56 pm
Reply with quote

Disadvantages against what ...
If i consider IF-ELSE & EVALUATE, then IF-ELSE affects readability if there are many comparisons.. There EVALUATE is better option.
Back to top
View user's profile Send private message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 177
Location: Seattle, WA

PostPosted: Tue Jun 12, 2007 12:26 am
Reply with quote

EVALUATE clause is good, very good.

Stacks of IF ELSE END-IF, IF ELSE END-IF, ad naseum are not good (if you are lucky enough to actually find END-IF used....).

Make us happy, use EVALUATE! icon_biggrin.gif

Seriously, there are no disadvantages to using EVALUATE, unless your aim is to write code that is hard for maintenance programmers to understand. Personally, I'd rather wade through two screens of Evaluates than a page of IF/ELSE/END-IF.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Tue Jun 12, 2007 1:31 am
Reply with quote

Good programming practice also calls for your last WHEN being WHEN OTHER, with either legitimate "other" processing code, or an error indicator if every possible case has been defined by the previous WHEN's, even if you know they have been.

No one will complain, quite the contrary, by the "extra" code. If nothing else, a future modification may screw up your perfect program.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Evaluate variable to execute a jcl step JCL & VSAM 3
This topic is locked: you cannot edit posts or make replies. regarding COBOL WRITE verb (VB File H... COBOL Programming 9
No new posts Logic of START verb with Read next COBOL Programming 6
No new posts Evaluate statement, when-clause in co... COBOL Programming 10
No new posts Generate report with out using IF/EVA... COBOL Programming 25
Search our Forums:

Back to Top