MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to handle -911 issue

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Susan_Yang
Beginner


Joined: 13 Feb 2006
Posts: 9
Topics: 7

PostPosted: Tue Sep 16, 2008 7:06 am    Post subject: How to handle -911 issue Reply with quote

I met a deadlock issue when using following logic in my PLI application program. The error is -501 which is caused by deadlock issue when preparing DYN_CURSOR_B. When -911 happens, the CURSOR_A is forced to be closed and SQL is rolled back. Thus -501 happens next time when CURSOR_A is fetched again without being opened.

1. Open CURSOR_A.
2. Fetch
3. Do while SQL = 0
Fetch CURSOR_A
Prepare DYN_CURSOR_B
...
...
END

4. Close CURSOR_A

My question is how to control the program not to enforce the CURSOR_A to be closed when -911 issue happened? So that I can handle the -911 issue by retrying to prepare DYN_CURSOR_B more than once.

Can anybody help me on that? Thanks a lot!! Smile
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Tue Sep 16, 2008 8:11 am    Post subject: Reply with quote

Your correctly stated that DB2 closes all cursors and issues a ROLLBACK when it issues a -911 sqlcode. Nothing you can do about either after DB2 issues the -911.

It seems strange that you would get a -911 on a PREPARE. Post the DB2 messages; the problem might be something else.
Back to top
View user's profile Send private message
edkir98
Beginner


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Thu Sep 18, 2008 6:49 am    Post subject: Reply with quote

Try using a hold cursor.
DECLARE CURSOR_A WITH HOLD FOR
_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Thu Sep 18, 2008 7:27 am    Post subject: Reply with quote

edkir98 wrote:
Try using a hold cursor.
DECLARE CURSOR_A WITH HOLD FOR


With HOLD applys to commits not to rollbacks.
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Thu Sep 18, 2008 10:48 am    Post subject: Reply with quote

Susan_Yang,

-911 would always CLOSE your cursor.

Try to check if your program has RESTART logic and in the RESTART step you might be missing opening of CURSOR.

Also, as mentioned by jsharon1248, please paste your error messages. It seems that Error is in the LOGICAL flow of program.


Thanks,
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group