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

What happens when one doesn't close the cursor in a COBOL


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

New User


Joined: 19 Mar 2006
Posts: 26
Location: India

PostPosted: Wed Jun 06, 2007 2:41 pm
Reply with quote

Hi,

What happens when one doesn't close the cursor in a COBOL program and try to run the program ?


Regards,
bh
Back to top
View user's profile Send private message
pcoreddy

New User


Joined: 14 Mar 2007
Posts: 24
Location: Mysore

PostPosted: Wed Jun 06, 2007 3:52 pm
Reply with quote

at end of the a COBOL program , the cursor will be closed automatically
Back to top
View user's profile Send private message
priyamnavada

New User


Joined: 24 Dec 2005
Posts: 52
Location: hyderabad

PostPosted: Wed Jun 06, 2007 4:00 pm
Reply with quote

if you try to open the same cursor again in the logic -502 error will occur.

-502 THE CURSOR IDENTIFIED IN AN OPEN STATEMENT IS ALREADY OPEN

Explanation: The application program attempted to execute an OPEN
statement for a cursor that was already open.

System Action: The statement cannot be executed. The cursor was unchanged
(that is, it was not 'reopened').

Programmer Response: Correct the logic of the application program to
ensure that it does not attempt to execute an OPEN statement for a cursor
that is already open.
Back to top
View user's profile Send private message
munikumar
Currently Banned

New User


Joined: 18 Apr 2007
Posts: 24
Location: India

PostPosted: Thu Jun 07, 2007 10:00 am
Reply with quote

Hi priyamnavada,

I believe, it will not give Open error, when we execute the program again. Because the program will close the cursor automatically when it ends. (Unless we specity WITH HOLD option).

Can you please give me the more details, if I am wrong?

Regards
Munikumar G
Back to top
View user's profile Send private message
priyamnavada

New User


Joined: 24 Dec 2005
Posts: 52
Location: hyderabad

PostPosted: Thu Jun 07, 2007 3:31 pm
Reply with quote

I am telling like in a particular execution of program, if the logic is to fetch a cursor for say 5 times, then it will be a problem.

if we try to open a cursor for the second time which is not been closed then it will gives problem.This is what i mean to say.
Back to top
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Thu Jun 07, 2007 4:33 pm
Reply with quote

It is not a probelm even though you didnt close the cursor. The Cursor will close automatically when the program ends.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top