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

db2 error code -502


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

New User


Joined: 29 Sep 2007
Posts: 93
Location: chenna/i-

PostPosted: Thu Apr 10, 2014 6:52 pm
Reply with quote

Hi,

while running an stored procedure i am getting -502 error code.

Thanks
siva
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Apr 10, 2014 6:59 pm
Reply with quote

Quoting from Manual

Quote:
-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.
SQLSTATE:
24502
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Fri Apr 11, 2014 5:56 am
Reply with quote

I am sure Siva must have Googled or checked the manual for this.

If you have a nested Stored Procedure then you might have to check everything and make sure the same cursor is not opened twice unless it is previously closed in the same Unit of Work.
Back to top
View user's profile Send private message
sivasaras

New User


Joined: 29 Sep 2007
Posts: 93
Location: chenna/i-

PostPosted: Fri Apr 11, 2014 2:58 pm
Reply with quote

hi,

Thaniks for the clarification. previously without closing the cursor itself the program worked, why suddeenly it is not working and getting -502 sqlcode.

that is the confusion for me

thsnks
siva
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Apr 11, 2014 5:05 pm
Reply with quote

Probably someone might have added a WITH HOLD and commiting it
Back to top
View user's profile Send private message
sivasaras

New User


Joined: 29 Sep 2007
Posts: 93
Location: chenna/i-

PostPosted: Fri Apr 11, 2014 5:33 pm
Reply with quote

i checked it is having WiTH RETURN for only and it is not necessary to close the cursor for online SPs which is calling from the Front end.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Wed Apr 16, 2014 4:11 am
Reply with quote

Yes, right. It is not necessary to close the cursor. it looks to me a logical problem with the code, you might have to see when does OPEN CURSOR executes and how many times.

Quote:
Thaniks for the clarification. previously without closing the cursor itself the program worked, why suddeenly it is not working and getting -502 sqlcode.


Have you changed anything in the program pertaining to CURSOR?
Back to top
View user's profile Send private message
sivasaras

New User


Joined: 29 Sep 2007
Posts: 93
Location: chenna/i-

PostPosted: Fri Apr 18, 2014 6:54 pm
Reply with quote

yes, i closed the cursor that shall it is working fine now with no issues
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 Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
Search our Forums:

Back to Top