IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 cursor


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
simimathew

New User


Joined: 26 Jan 2006
Posts: 23
Location: London

PostPosted: Tue May 09, 2006 6:55 pm
Reply with quote

Hi,

Can somebody tell me what happens when a DB2 cursor has been opened, fetching and processing is done and the cursor is not closed programatically? Will all the cursors used in the program be automatically closed at the end of run (batch programs)?
Back to top
View user's profile Send private message
hariavinash

New User


Joined: 04 Jan 2006
Posts: 64

PostPosted: Tue May 09, 2006 8:36 pm
Reply with quote

Unless you do a COMMIT, cursor will still be active. but a cursor declared with HOLD option will not close the cursor even on commit.

cheers
Back to top
View user's profile Send private message
vijayamadhuri

Active User


Joined: 06 Apr 2005
Posts: 180

PostPosted: Tue May 09, 2006 8:52 pm
Reply with quote

please follow this linkhttp://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/dsnapj12/2.2.3.2?SHELF=&DT=20050328013405&CASE=
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue May 09, 2006 11:41 pm
Reply with quote

simimathew,

Yes, an open cursor is closed by the operating system at termination of your job, just as it closed any PS/VSAM files. It is, however, good practice to close all open files cursors within you program prior to ending.

Dave
Back to top
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Wed May 10, 2006 12:05 am
Reply with quote

David,
But what happens in an Abend situation, does it still close. I have had some problem with VSAM files, if they are not properly closed. Any idea.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed May 10, 2006 12:16 am
Reply with quote

die7nadal,

Yes for abends that cursor is also closed.

The only problem, and really not a problem, with VSAM files on abends is that it gives a open status of 97 instead of 00. This is OK and just a warning that the last time the VSAM file was used it did not close normally. Have you experienced other problems?

Dave
Back to top
View user's profile Send private message
simimathew

New User


Joined: 26 Jan 2006
Posts: 23
Location: London

PostPosted: Wed May 10, 2006 2:21 pm
Reply with quote

Thanks a lot for all the information.

Cheers,
Simi
Back to top
View user's profile Send private message
anilpalcs

New User


Joined: 10 May 2006
Posts: 1

PostPosted: Thu May 11, 2006 10:37 am
Reply with quote

HI,
i m facing some problem during cursor opening. during cursor opening
it show the sqlcode 00099j
plz help me as soon as possible
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts Restart logic by using cursor name in... DB2 1
No new posts Seeking Resolution for SQKCODE -991 o... DB2 2
No new posts Multiple rows within Cursor when Coun... DB2 14
No new posts Dynamic cursor name in Cobol program COBOL Programming 1
Search our Forums:

Back to Top