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: 10255
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 IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts RC 20 for Address ISPEXEC "ISRED... pkmurali CLIST & REXX 3 Sun Apr 16, 2017 11:30 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm


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