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: 10276
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 Changeman get multiple "Browse C... elixir1986 Compuware & Other Tools 4 Fri Jul 14, 2017 1:48 am
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Include/omit with "ALL" pa... mgl DFSORT/ICETOOL 6 Wed Jun 14, 2017 2:31 pm
No new posts NDM syntax checking without actually ... GAPX1 All Other Mainframe Topics 0 Wed Jun 07, 2017 2:36 am


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