Page 1 of 1

Evaluate Statement

PostPosted: Fri Jul 26, 2013 4:44 pm
by sriharsha186
If evaluate statement is to be replaced which one of these suits better?

NESTED IF, IF THEN ELSE, IF ELSE

Re: Evaluate Statement

PostPosted: Fri Jul 26, 2013 4:49 pm
by NicC
Depends.

Why do you want to replace it, anyway?

Re: Evaluate Statement

PostPosted: Fri Jul 26, 2013 4:52 pm
by sriharsha186
Well, it was a question I was asked. "Evaluate is similar to"

Re: Evaluate Statement

PostPosted: Fri Jul 26, 2013 4:56 pm
by NicC
Why don't you look up the book/notes you used when learning COBOL? Or is this an interview question that should have been posted in the Interview Questions section along with your response.

Re: Evaluate Statement

PostPosted: Fri Jul 26, 2013 9:31 pm
by dick scherrer
Hello and welcome to the forum,

Hopefully, when the question was asked, more info was given.

As asked, the only answer i would give would be the same as Nic's - it depends.

Re: Evaluate Statement

PostPosted: Fri Jul 26, 2013 11:50 pm
by c62ap90
All 3 as it was before COBOL II.

Re: Evaluate Statement

PostPosted: Fri Jul 26, 2013 11:53 pm
by NicC
Actually, there are only 2 options there as IF ELSE is a synonym of IF THEN ELSE.

Re: Evaluate Statement

PostPosted: Sat Jul 27, 2013 4:07 am
by BillyBoyo
If you were looking at directly replacing existing code with an EVALUATE, the most likely candidates would be a "nested IF", a series of IFs with GO TOs or a plain old GO TO ... DEPENDING ON ...

However, you could replace any IF with an EVALUATE in its simplest form, or number of IFs of any variety if you would accept a non-1:1 relationship between what was replaced and the "legs" of the EVALUATE.