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
 

 

sqlcode -501 in cursor

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

New User


Joined: 12 Mar 2010
Posts: 9
Location: Madrid

PostPosted: Thu Sep 01, 2011 2:31 pm    Post subject: sqlcode -501 in cursor
Reply with quote

Hi all. I've been searching in the forum about sqlcode -501, but didn't find the answer to my problem.

I have a cursor and when I fetch it, it returns a sqlcode -501. My main problem is that the previous instruction is the OPEN and it returns a sqlcode 0.

So guys, if I have my cursor correctly opened, any idea about why I'm receiving the -501 in the fetch?

Thank you so much.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Sep 01, 2011 2:39 pm    Post subject: Reply to: sqlcode -501 in cursor
Reply with quote

Quote:
I've been searching in the forum about sqlcode -501


it would have been wiser to search the manuals, You would not have used other people time icon_cool.gif

see here for the explanation of the -501 sqlcode
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/dsnc1k17/3.2.222?ACTION=MATCHES&REQUEST=501&TYPE=FUZZY&SHELF=&DT=20100614130926&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT

You opened <some> cursor and fetched a <different> one !

Quote:
So guys, if I have my cursor correctly opened, any idea about why I'm receiving the -501 in the fetch?

You should be able to by just reading the program !
Back to top
View user's profile Send private message
ElHachu

New User


Joined: 12 Mar 2010
Posts: 9
Location: Madrid

PostPosted: Thu Sep 01, 2011 2:48 pm    Post subject:
Reply with quote

I have done it. I don't like others to waste my time, so I don't like to waste others'. If I ask is because I have finished all my resources (books, manuals, team mates, searching this and other forums...).

In this program there is only one cursor. Seeing your answer I checked it (with automatic code generator you never know).

We think the OPEN isn't working properly, but we can't explain it if we receive a sqlcode 0.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Sep 01, 2011 2:55 pm    Post subject: Reply to: sqlcode -501 in cursor
Reply with quote

If You had You should have understood that the manual is DEFINITIVE about the reason
so the way You posed Your question is just a waste , confirm, WASTE of time for everybody !
and You should not have expected any other reply icon_evil.gif

Quote:
We think the OPEN isn't working properly
36_11_6.gif
how many millions of open cursor are taking place right now ....
and how unlucky that Yours is not working properly
You should be asking on a witchcraft forum, not an IT one ....
Back to top
View user's profile Send private message
ElHachu

New User


Joined: 12 Mar 2010
Posts: 9
Location: Madrid

PostPosted: Thu Sep 01, 2011 3:05 pm    Post subject: Re: Reply to: sqlcode -501 in cursor
Reply with quote

enrico-sorichetti wrote:
If You had You should have understood that the manual is DEFINITIVE about the reason


I know. That's why I ask, I think I made a mistake I didn't notice.

I can't understand why you get angry, I checked the manuals, the code... everything before posting. And I do tests. Don't think I am like some people here who prefer asking in the forum instead of googling a bit before. You didn't need to be so rude.

Well, no problem, don't waste your time anymore..


Bye forever
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Sep 01, 2011 3:10 pm    Post subject: Reply to: sqlcode -501 in cursor
Reply with quote

I am not getting angry... ( I just like to play around with words )
it is just that with the info You provided, I gave You the only reasonable reply..

if You believe that You have done the due diligence, then the only thing left is to open a ticket with IBM
Back to top
View user's profile Send private message
ElHachu

New User


Joined: 12 Mar 2010
Posts: 9
Location: Madrid

PostPosted: Thu Sep 01, 2011 3:24 pm    Post subject:
Reply with quote

Sorry Enrico. That is the problem when you "talk" to someone and don't see the face. Let's start again, ok? icon_wink.gif

I pasted the sql sentences in a plain new program and work...

I think there is a problem with that fu... automaticly generated code. I hate it.

We are making tests in order to get where is the error. I won't sleep till I get it!!! God is my witness!

When found, I'll post here and sure we'll laugh
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Sep 01, 2011 3:41 pm    Post subject: Reply to: sqlcode -501 in cursor
Reply with quote

let' s sing with the Pink Floyds
we don' t need no automation ...
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7226

PostPosted: Thu Sep 01, 2011 4:16 pm    Post subject:
Reply with quote

ElHachu wrote:
[...]I think there is a problem with [...] automaticly generated code. [...]


Can you post the stuff here, including some in front and after the SQL that now works?
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Thu Sep 01, 2011 7:41 pm    Post subject:
Reply with quote

Are you sure there aren't any fetches (with sqlcodes) that cause the cursor to get closed.
Or that you have passed the CLOSE statement in the code?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Sep 01, 2011 7:55 pm    Post subject:
Reply with quote

either you are fetching a different cursor than was opened
or the one you opened was closed before the fetch.

not anymore complicated than that.

take a look at the dbrm that was generated.
Back to top
View user's profile Send private message
mambopras

New User


Joined: 11 Nov 2008
Posts: 52
Location: Hyderabad

PostPosted: Sun Sep 11, 2011 11:27 pm    Post subject: Reply to: sqlcode -501 in cursor
Reply with quote

I hope no COMMITs were issued before trying to fetch - (Just in case)
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 Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts DB2 Stored Procedure - Dynamic SQL - ... GuyC DB2 2 Wed Feb 17, 2016 5:10 pm
No new posts ISREDIT - Position Cursor on the Comm... Tarique Anwer TSO/ISPF 5 Wed Feb 03, 2016 12:44 pm
No new posts SQLCODE-000000080N priya91 DB2 1 Mon Feb 01, 2016 4:35 pm


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