Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
how to resolve the sql code -501

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> ABENDS & Debugging
View previous topic :: :: View next topic  
Author Message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 92
Location: bangalore

PostPosted: Wed Jan 02, 2008 10:08 am    Post subject: how to resolve the sql code -501
Reply with quote

hai pls explain me how to resolve the sql code -501.
Back to top
View user's profile Send private message

ousep143

New User


Joined: 06 Oct 2007
Posts: 32
Location: India

PostPosted: Wed Jan 02, 2008 10:31 am    Post subject: Re: how to resolve the sql code -501
Reply with quote

Hi Chandra,
Without opening a cursor,you have to fetch or close the cursor.Before fetch the data from DB2,you must open the cursor.

Regards
icon_smile.gif
Back to top
View user's profile Send private message
kovur

New User


Joined: 15 Nov 2007
Posts: 37
Location: India

PostPosted: Wed Jan 02, 2008 11:36 am    Post subject: Reply to: how to resolve the sql code -501
Reply with quote

Explanation: The application program attempted to either:

FETCH using a cursor, or

CLOSE a cursor


at a time when the specified cursor was not open.
System Action: The statement cannot be executed.

Programmer Response: Check for a previous SQL return code that may have closed the cursor. Commit and rollback operations close cursors. SQLCODES -404, -652, -679, -802, -901, -904, -909, -910, -911, -913, and -952 may force the cursor to close. After the cursor is closed, any fetches or close cursor statements will receive this SQLCODE -501.

If no previous SQL return codes have been issued, correct the logic of the application program to ensure that the cursor is open at the time the FETCH or CLOSE statement is executed.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Wed Jan 02, 2008 1:52 pm    Post subject:
Reply with quote

Hi,

Description of error is "-501 Cursor not open on FETCH". Description itself is self-explanatory.
Back to top
View user's profile Send private message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 92
Location: bangalore

PostPosted: Fri Jan 04, 2008 7:52 am    Post subject: Reply to: how to resolve the sql code -501
Reply with quote

Hai frends i know -501 is the cursor problem i just want to how to resolve that one, please explain me
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Jan 04, 2008 8:21 am    Post subject: Re: Reply to: how to resolve the sql code -501
Reply with quote

chandracdac wrote:
Hai frends i know -501 is the cursor problem i just want to how to resolve that one, please explain me


OPEN the cursor before you do a fetch!
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Fri Jan 04, 2008 2:58 pm    Post subject:
Reply with quote

Chandra,

If you still couldn't understand the solution, post your code. We can provide the solution.

KSK
Back to top
View user's profile Send private message
rag swain

New User


Joined: 17 Dec 2007
Posts: 33
Location: pune,INDIA

PostPosted: Sat Jan 26, 2008 5:50 am    Post subject: Reply to: how to resolve the sql code -501
Reply with quote

Check the option of using WITH HOLD coz sometimes while you do a fetch and process data and afterwards explicitly do a COMMIT, the cursor is closed, the next time when you try to fetch, end up with -501 error. thats why it says do an OPEN on the cursor before FETCH.
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 -> ABENDS & Debugging All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. how to code for GDG in Rexx cvnlynn CLIST & REXX 13 Wed Aug 09, 2017 9:13 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am
No new posts I want to retire TRX and use only Rex... Abhinav Sharma CLIST & REXX 6 Sat Jul 29, 2017 2:53 am
No new posts UNIT=AFF for Easytrieve code gandikk JCL & VSAM 7 Wed Jul 12, 2017 11:42 pm
No new posts DB2 Program abending without giving a... rahulgarg14 DB2 7 Mon May 29, 2017 8:10 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us