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

Performance of IF loop and Evaluate


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

New User


Joined: 16 Jul 2005
Posts: 15
Location: India - Chennai

PostPosted: Thu Dec 15, 2005 12:42 pm
Reply with quote

Hi,

Can any body tell me about performance of IF(Nested If) and Evaluate?

Which one is better to use?

Thanks,

Abirami.YN
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Thu Dec 15, 2005 1:01 pm
Reply with quote

Hi Abirami,

Shortening your instruction path can also improve your runtime efficiency, sometimes as dramatically as improving your I/O. Here are some tips for writing efficient procedure logic:

In a nested IF statement or an EVALUATE case structure, you can shorten your instruction path if you know in advance that certain conditions occur much more frequently than others. Test for these conditions early. That bypasses all the logic to test for the less common situations.

Hope this helps.
Back to top
View user's profile Send private message
raghunathns

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Thu Dec 15, 2005 2:27 pm
Reply with quote

HI,

i think if you have more than 3 nested if's then it is better to go for Evaluate.
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Thu Dec 15, 2005 2:44 pm
Reply with quote

Hi Abirami,


To be more precise EVALUATE will be efficient in most of the cases. It all depends on the situation how many conditions you are going to check.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Thu Dec 15, 2005 5:47 pm
Reply with quote

One thing apart from readability & more structured programming which supports use of EVALUATE over NESTED IF statements is that we can terminate it by a simple END-EVALUATE, instead of a long thread of IF chain may require an equally long END-IF chain.

Regards,

Priyesh.
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
This topic is locked: you cannot edit posts or make replies. REXX - Do - Not able to LOOP CLIST & REXX 10
No new posts exploiting Z16 performance PL/I & Assembler 2
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Evaluate variable to execute a jcl step JCL & VSAM 3
No new posts REXX - Dataset checking in a do forev... CLIST & REXX 6
Search our Forums:

Back to Top