Not coding "When Other" in EVALUATE statement



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Not coding "When Other" in EVALUATE statement

Postby arhamjain123 » Mon Jun 20, 2011 5:14 pm

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
arhamjain123
 
Posts: 2
Joined: Thu Jun 16, 2011 4:22 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Not coding "When Other" in EVALUATE statement

 

Re: Not coding "When Other" in EVALUATE statement

Postby Robert Sample » Mon Jun 20, 2011 7:20 pm

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.

These users thanked the author Robert Sample for the post:
mcharitha (Sun Jan 18, 2015 8:41 pm)
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: Not coding "When Other" in EVALUATE statement

Postby arhamjain123 » Tue Jun 21, 2011 1:14 pm

Thanks Robert...Yup ..I didnt read manual..will download it for furthur queries.
arhamjain123
 
Posts: 2
Joined: Thu Jun 16, 2011 4:22 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post