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

sqlcode -501 in cursor


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Sep 01, 2011 2:39 pm
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
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Sep 01, 2011 2:55 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Sep 01, 2011 3:10 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Sep 01, 2011 3:41 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Sep 01, 2011 4:16 pm
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: 1281
Location: Belgium

PostPosted: Thu Sep 01, 2011 7:41 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts SQLCODE = -122 while using the scalar... DB2 4
No new posts SQLCODE = -16002 when using XMLEXISTS DB2 1
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts Restart logic by using cursor name in... DB2 1
No new posts Seeking Resolution for SQKCODE -991 o... DB2 2
Search our Forums:

Back to Top