Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Dynamic sql in cusor

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
aimprabhu

New User


Joined: 12 Aug 2008
Posts: 11
Location: chennai

PostPosted: Mon Jun 08, 2009 5:10 pm    Post subject: Dynamic sql in cusor
Reply with quote

After compilation of the program, while opening the cursor we are getting -514 error.

Following is the steps we are following :

Declare cursor

Prepare the host variable

Open cursor


Is there any solution for the same??
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Mon Jun 08, 2009 6:16 pm    Post subject:
Reply with quote

have to assume that you did not bother to read the manual.

Quote:
The application program has tried to use a cursor, 'cursor-name,' that is not in a prepared state.
The cursor is associated with a statement that either
(1) has never been prepared,
or (2) has been invalidated by a COMMIT or ROLLBACK (or the IMS/VS or CICS equivalent).


the user response (from the manual):
Quote:
For case (1), ensure that you prepare the statement that is named in the DECLARE CURSOR statement for 'cursor-name' before you try to open the cursor.
For case (2), either do not issue COMMIT or ROLLBACK until after you are finished using the cursor, or prepare the statement again after the COMMIT or ROLLBACK.
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 186
Location: chennai

PostPosted: Mon Jun 08, 2009 10:58 pm    Post subject: Reply to: Dynamic sql in cusor
Reply with quote

Hi Prabhu

What type of program you are using - Batch or CICS on-line?

Regards
Raghu
Back to top
View user's profile Send private message
aimprabhu

New User


Joined: 12 Aug 2008
Posts: 11
Location: chennai

PostPosted: Tue Jun 09, 2009 9:31 am    Post subject: Re: Reply to: Dynamic sql in cusor
Reply with quote

Hi Raghu,

We are using batch pgm

Regards
Prabhu






Hi Prabhu

What type of program you are using - Batch or CICS on-line?

Regards
Raghu[/quote]
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 186
Location: chennai

PostPosted: Tue Jun 09, 2009 12:17 pm    Post subject: Reply to: Dynamic sql in cusor
Reply with quote

Hi Prabhu

If you are using a Dynamic SQL program, make sure that the PREPARE statement is executed successfully. Then only you can open the cursor.

If not, do not use COMMIT or ROLLBACK before FETCH. This COMMIT or ROLLBACK will CLOSE the cursor.

If the problem is not solved and you are using a Dynamic SQL program then post your variable declaration in the forum. Some one will help you.

Regards
Raghu
Back to top
View user's profile Send private message
aimprabhu

New User


Joined: 12 Aug 2008
Posts: 11
Location: chennai

PostPosted: Tue Jun 09, 2009 12:32 pm    Post subject: Re: Reply to: Dynamic sql in cusor
Reply with quote

Hi Raghu,

Thanks for your quick turnout. It was problem with PREPARE statement.We have solved this issue


Regards,
Prabhu

Raghu navaikulam wrote:
Hi Prabhu

If you are using a Dynamic SQL program, make sure that the PREPARE statement is executed successfully. Then only you can open the cursor.

If not, do not use COMMIT or ROLLBACK before FETCH. This COMMIT or ROLLBACK will CLOSE the cursor.

If the problem is not solved and you are using a Dynamic SQL program then post your variable declaration in the forum. Some one will help you.

Regards
Raghu
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 186
Location: chennai

PostPosted: Tue Jun 09, 2009 12:35 pm    Post subject: Reply to: Dynamic sql in cusor
Reply with quote

Hi Prabhu

Glad to hear from you

Regards
Raghu
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts Creating a dynamic sort card in JCL u... ChitraChhabra DFSORT/ICETOOL 4 Wed Aug 03, 2016 6:15 pm
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us