Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQLCODE -911 Industry Best Paratice?

Status
Not open for further replies.
M

Member 310024

Guest
Is there an industry best practice for avoiding -911 errors in COBOL/DB2? How does DB2 work behind the scenes? For example, does DB2 retry for a couple of times, or does it crash on the first deadlock? Does the DBA set some sort of parameter which directs DB2 what to do in the case of a deadlock? Would it be acceptable to pause the program (say, by a dummy module which loops for 1 second) after trapping the -911 return code, and then trying again? Would that work? Would the currency of the FETCH remain correct ie would the FETCH retry the same record that 911'd, or would it try the next record?
 
A deadlock is a deadlock and best practice is to design your application in a way to avoid it.
One application (usually the 2nd to come) gets a rollback with sqlcode -911, the other just continues, thats all.

How you handle a -911 is your decision, a retry might be a good option.

If you have lots of deadlocks, check on your isolation level. If you are using RR or RS consider setting it to the default CS. And take a snapshot and try to find out who caused it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top