Page 1 of 1

Not coding "When Other" in EVALUATE statement

PostPosted: Mon Jun 20, 2011 5:14 pm
by arhamjain123
Hi,

What will happen if i dont code "When Other" Statement in Evaluate Verb.
Exp.

Evaluate PIM1
When 1
Display "ABC"
When 2
Display "PSB"
End-Evaluate.

And suppose value of PIM1 is 3, what will happen.

Cant test myselp as i dont have access to mainframe.

Thanks in advance

Re: Not coding "When Other" in EVALUATE statement

PostPosted: Mon Jun 20, 2011 7:20 pm
by Robert Sample
I have found the manuals to be quite helpful in resolving such questions. Specifically, the COBOL Language Reference manual has this to say:
6.2.13.4 Executing the EVALUATE statement


After the comparison operation is completed, execution of the EVALUATE statement proceeds as follows:

If a WHEN phrase is selected, execution continues with the first imperative-statement-1 following the selected WHEN phrase. Note that multiple WHEN statements are allowed for a single imperative-statement-1.

If no WHEN phrase is selected and a WHEN OTHER phrase is specified, execution continues with imperative-statement-2.

If no WHEN phrase is selected and no WHEN OTHER phrase is specified, execution continues with the next executable statement following the scope delimiter.

The scope of execution of the EVALUATE statement is terminated when execution reaches the end of the scope of the selected WHEN phrase or WHEN OTHER phrase, or when no WHEN phrase is selected and no WHEN OTHER phrase is specified.
If you don't have the IBM manuals bookmarked, you should do so immediately. Many of the questions on this forum would never have been asked if the poster had just read the manual first.

Re: Not coding "When Other" in EVALUATE statement

PostPosted: Tue Jun 21, 2011 1:14 pm
by arhamjain123
Thanks Robert...Yup ..I didnt read manual..will download it for furthur queries.