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

Opening Cursor when Table is locked


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sarangwagh7

New User


Joined: 15 Mar 2007
Posts: 13
Location: Pune

PostPosted: Fri Mar 16, 2007 12:23 pm
Reply with quote

I am using the cursor in my Program.

So if the Table is locked on which i have declared the cursor, the error should be at "Opening Cursor"

But i am getting error while Fetching the Cursor.
It gets successfully open even if the Table is lock.
Please explain the scenario.
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Fri Mar 16, 2007 1:14 pm
Reply with quote

Can you post the query here..? Is there any host variable in the query..?
Is the vaule supplied to the host variable before opening the cursor..?
Back to top
View user's profile Send private message
sarangwagh7

New User


Joined: 15 Mar 2007
Posts: 13
Location: Pune

PostPosted: Fri Mar 16, 2007 5:19 pm
Reply with quote

The embbeded fetch query has host variable.

Code:
EXEC SQL
          FETCH   NN00-CUR                                       
          INTO     :NN00-TRAN-IND,
                      :NN00-DNM-ITEM-CDE, 
                      :NN00-TRAN-TYP-CDE                               
END-EXEC

My doubt is, if the table is locked, then the cursor should not get open
it should give SQLCODE not equal to 0

But its getting open successfully and giving error at the time of fetch.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Mar 16, 2007 5:53 pm
Reply with quote

And how is the table locked?
Back to top
View user's profile Send private message
Lkmi

New User


Joined: 04 Mar 2005
Posts: 53
Location: Newyork

PostPosted: Sat Mar 17, 2007 12:58 am
Reply with quote

opening of cursor actually just points to the data...it doesnt try 2 get the data...fetch is when the data is fetched..tht might be the reason for the error during fetch instead of open.
Back to top
View user's profile Send private message
sarangwagh7

New User


Joined: 15 Mar 2007
Posts: 13
Location: Pune

PostPosted: Tue Mar 20, 2007 11:53 am
Reply with quote

Thanks LK
Back to top
View user's profile Send private message
Lkmi

New User


Joined: 04 Mar 2005
Posts: 53
Location: Newyork

PostPosted: Tue Mar 20, 2007 6:20 pm
Reply with quote

No..probs...welcome... icon_biggrin.gif
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 Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top