View previous topic :: View next topic
|
Author |
Message |
anand jeyapaul
New User
Joined: 26 Oct 2017 Posts: 12 Location: india
|
|
|
|
Hi
My PL/I program is calling a Cobol DB2 Stored procedure which has a cursor.
Only a open cursor is coded in the Cobol DB2 Stored procedure.
How do I close the cursor in the called program from the calling program(PL/I). the close or commit statement in the calling program is not working.
I am getting error
DSNT408I SQLCODE = -502, ERROR: THE CURSOR IDENTIFIED IN AN OPEN STATEMENT IS ALREADY OPEN |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
|
|
Why do you want to close the cursor in the called program? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Your message indicates that you are trying to open the cursor - not close it. Why not close the cursor in the called program? You may need to call it with a parameter so that it knows to close the cursor. |
|
Back to top |
|
|
anand jeyapaul
New User
Joined: 26 Oct 2017 Posts: 12 Location: india
|
|
|
|
Nic/Rohit..Thank you for your suggestion. We cannot close the cursor in the called program as that is a common stored procedure run by another group. The stored proc is called by java programs...Hence we are trying to close the cursor in the calling program.
Regards
Anand Jeyapaul |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
So how does that other group close the cursor in their called programs? |
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
Cursors in stored procedure will Not be closed in the stored procedure program. They will only be opened. Then, your PL/1 program will fetch and close the cursor (after associate locators and allocate cursor).
So, I think what you were doing in your earlier post is correct. You should concentrate on why you would get a -440.
You would need to check the possible causes step by step and make sure nothing is missed (start with the routine name and post the error message for -440).
. |
|
Back to top |
|
|
anand jeyapaul
New User
Joined: 26 Oct 2017 Posts: 12 Location: india
|
|
|
|
Thanks Rahul. That was informative and encouraging. Yes I have contacted the DBA for the earlier post for the error -440. I am proceeding in the direction you have outlined..Thanks. |
|
Back to top |
|
|
|