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

Checking the "SQLWARNING' when a DB2 program starts.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
JayC

New User


Joined: 27 Sep 2008
Posts: 70

PostPosted: Fri Mar 20, 2009 7:08 pm
Reply with quote

I have a db2 program that has the following coded in the very beginning of the PROCEDURE DIVISION :
Code:

EXEC SQL WHENEVER SQLWARNING
GO TO 0000-PROGRAM-EXIT   
END-EXEC                   
EXEC SQL WHENEVER SQLERROR 
GO TO 0000-PROGRAM-EXIT   
END-EXEC                   


I read from the manual that "WHENEVER" can be used as a exception checking routine. But we usually place this after a particular SQL request, why wold we want to place it in the beginning - before and SQL query is executed ?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 20, 2009 9:18 pm
Reply with quote

reread carefully the manual

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/dsnsqk13/5.133?ACTION=MATCHES&REQUEST=whenever&TYPE=FUZZY&SHELF=DSNSHKA2.bks&DT=20080220164427&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT

quoting the tricky part...
Quote:
Every executable SQL statement in an application program is within the scope of one implicit or explicit WHENEVER statement of each type.
The scope of a WHENEVER statement is related to the listing sequence of the statements in the application program, not their execution sequence.
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts PuTTY - "User is not a surrogate... IBM Tools 5
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
Search our Forums:

Back to Top