close cursor
Last Post 21 Mar 2013 11:54 PM by B.Hauser. 2 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
mukesh kumar
New Member
New Member
Posts:14

--
20 Mar 2013 01:19 PM
How to track  all the current  open cursor and close it perodically in db2 database?
Lynne Noll
Senior Member
Senior Member
Posts:6567

--
21 Mar 2013 03:22 PM
Why not close them when you are done with them?

Cursors opened at the activation group level are closed when you do a RCLACTGRP. However, the activation group will not reclaim if a program in it is still being executed.



B.Hauser
Veteran Member
Veteran Member
Posts:2037

--
21 Mar 2013 11:54 PM
What exactly do you mean with CLOSE Cursor?
Executing a SQL CLOSE statement or a HARD CLOSE (i.e. closing the ODP)?

When running your SQL statements under commitment control and your cursors are not defined with "WITH HOLD" the cursors get closed (pseudo close, i.e. the ODPs are NOT deleted) when executing either an SQL COMMIT or ROLLBACK.
When compiling your program with CLOSQLCSR = *ENDMOD the cursors are hard closed (i.e. the ODPs are deleted) as soon as the module is left.
When compiling your program with CLOSQLCSR = *ENDACTGRP the cursors are hard closed as soon as the activation groupr ends.
When calling a program repeadetly *ENDMOD or activation group *NEW should not be used due to performance issues, because full optimation, especially (re)opening the ODP is a very time consuming process.
A hard close will also occur if you access tables and views without specifying a library/schema and your library list is changed, i.e. your data library is removed from the library list (and readded again).

Birgitta
You are not authorized to post a reply.

Acceptable Use Policy