For iSeries, when a problem is encountered when running a query through the SQL window in Operations Navigator, sometimes it is difficult to figure out what the issue with your query is based on the information that navigator shows you.
It is possible to get more information about what caused the problem with your query by looking at the joblog through a green screen. However, how do you find the job?
The name of the job that services sql requests on iSeries is QZDASOINIT. Using a wrkjob command on that jobname, find the job that is servicing your query window. Option 1 to select the job, 10 to work with the joblog, F10 and F18 to go to the bottom of the joblog, and you should find more information about the problem with your query.
Tuesday, May 26, 2009
Sunday, February 15, 2009
DB2 Commit Hold
I discovered something today in SQL Stored procedures for DB2 that I thought you all might like to know.
If you have a SQL stored procedure (A) that calls another SQL stored procedure (B), if you are looping through a cursor in procedure A and you have a commit in procedure B, when the commit in procedure B is executed, it will close the cursor that you are looping through in procedure A.
To resolve this issue, you need to change the COMMIT statement in procedure B to COMMIT HOLD. This keeps the cursor in procedure A open when the COMMIT is executed. Make sure you remember to close your cursor in procedure A when you are done with it.
Don’t you all feel smarter now?
If you have a SQL stored procedure (A) that calls another SQL stored procedure (B), if you are looping through a cursor in procedure A and you have a commit in procedure B, when the commit in procedure B is executed, it will close the cursor that you are looping through in procedure A.
To resolve this issue, you need to change the COMMIT statement in procedure B to COMMIT HOLD. This keeps the cursor in procedure A open when the COMMIT is executed. Make sure you remember to close your cursor in procedure A when you are done with it.
Don’t you all feel smarter now?
Subscribe to:
Comments (Atom)
