Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Checking the "SQLWARNING' when a DB2 program starts.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Checking the "SQLWARNING' when a DB2 program starts.
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Fri Mar 20, 2009 9:18 pm    Post subject: Reply to: Checking the "SQLWARNING' when a DB2 program
Reply with quote

reread carefully the manual

http://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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us