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

Question regarding EVALUATE


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Lord.of.Wind

New User


Joined: 17 Nov 2005
Posts: 60

PostPosted: Wed May 31, 2006 1:49 pm
Reply with quote

05 WS-SQL-RETCODE PIC S9(04) COMP VALUE +0.
88 C-DB2-OK VALUE +0.
88 C-REC-NOT-FOUND VALUE +100.
88 C-DUPLICATE VALUE -811.

MOVE SQLCODE TO WS-SQL-RETCODE
EVALUATE TRUE
WHEN C-DB2-OK
WHEN C-REC-NOT-FOUND
CONTINUE

WHEN OTHER
SET MESSAGE-REC-NOT-FOUND TO TRUE
PERFORM A080-MOVE-TO-SBAM511-O
END-EVALUATE

Could anybody tell me if the red-highlighted codes are right which means when C-DB2-OK or C-REC-NOT-FOUND ?
Back to top
View user's profile Send private message
sada_polaris

New User


Joined: 24 May 2006
Posts: 13

PostPosted: Wed May 31, 2006 3:16 pm
Reply with quote

Quote:
05 WS-SQL-RETCODE PIC S9(04) COMP VALUE +0.
88 C-DB2-OK VALUE +0.
88 C-REC-NOT-FOUND VALUE +100.
88 C-DUPLICATE VALUE -811.

MOVE SQLCODE TO WS-SQL-RETCODE
EVALUATE TRUE
WHEN C-DB2-OK
WHEN C-REC-NOT-FOUND
CONTINUE
WHEN OTHER
SET MESSAGE-REC-NOT-FOUND TO TRUE
PERFORM A080-MOVE-TO-SBAM511-O
END-EVALUATE


Use as follows

Code:

MOVE SQLCODE TO WS-SQL-RETCODE
EVALUATE TRUE
WHEN C-DB2-OK  OR C-REC-NOT-FOUND
CONTINUE
WHEN OTHER
SET MESSAGE-REC-NOT-FOUND TO TRUE
PERFORM A080-MOVE-TO-SBAM511-O
END-EVALUATE

Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed May 31, 2006 5:56 pm
Reply with quote

That's right, this format is equivalent to an 'OR'.
For example, I use this in my CICS programs:

Code:
EVALUATE EIBAID
    WHEN DFHCLEAR
    WHEN DFHPF3
    WHEN DFHPF15
        PERFORM PROGRAM-FINISH
    WHEN DFHPF8
    WHEN DFHPF20
        PERFORM PAGE-DOWN
    WHEN ...

END-EVALUATE


The IBM documentation says:
"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."
Back to top
View user's profile Send private message
Lord.of.Wind

New User


Joined: 17 Nov 2005
Posts: 60

PostPosted: Thu Jun 01, 2006 7:09 am
Reply with quote

THANK YOU ALL! icon_smile.gif
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
No new posts Question for file manager IBM Tools 7
No new posts question for Pedro TSO/ISPF 2
No new posts Evaluate variable to execute a jcl step JCL & VSAM 3
No new posts question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
No new posts panel creation question TSO/ISPF 12
Search our Forums:

Back to Top