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

Explain EVALUATE with Examples


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sekarvnm
Currently Banned

New User


Joined: 06 Oct 2006
Posts: 4
Location: NAGERCOIL

PostPosted: Fri Oct 06, 2006 12:13 pm
Reply with quote

CAN ANY BODY EXPLAIN EVALUATE WITH EXAMPLE.WHICH SITUATION WE CAN USE
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Fri Oct 06, 2006 12:27 pm
Reply with quote

Hi SEKAR,

The EVALUATE command provides a shorthand notation for a series of nested IF statements.
Another example

Evaluate sqlcode
when +0
Continue
when +100
Display ' row not found'
When other
Raise an error
End-Evaluate.

In these code if sqlcode is eq to 0 it will execute next sentennce if +100 then it will display row is not found & if it is other than 0 & 100 it will raise the error

The equivalent IF command:

IF (sqlcode>= 0)
continue
ELSE
IF (sqlcode = 100)
Display 'row not found'
Else
raise an error
END-IF
END-IF.
Few notes.
Only one WHEN branch is chosen per execution of the EVALUATE, and the checking of the WHEN branches is done from top to bottom.

If none of the WHEN branches can be chosen, and a WHEN OTHER phrase exists, the WHEN OTHER branch is executed.

If none of the WHEN branches can be chosen, and there is no WHEN OTHER phrase, the EVALUATE simply terminates.
Hope it will helpful
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts DB2 Statistics - Using EXPLAIN and qu... DB2 1
No new posts Evaluate variable to execute a jcl step JCL & VSAM 3
No new posts Can you give me examples of programs ... CLIST & REXX 22
No new posts Any examples of calling FTP from REXX? CLIST & REXX 1
No new posts Mainframe ASSEMBLER LEARNING MANUAL w... PL/I & Assembler 2
Search our Forums:

Back to Top