MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

cursor Logic

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
badri5
Banned


Joined: 27 Jun 2006
Posts: 18
Topics: 16

PostPosted: Wed Sep 02, 2009 9:42 am    Post subject: cursor Logic Reply with quote

I am stuck up with the logic of a cursor.

Select a from table a

If sqlcode = 0 from table a---( i have to use declare,fetch and close .ie from fetch sqlcode = 0) i am selecting b from table b--i am selecting many records

Then

select b from table b

If sqlcode = 0



where will i close the cursor
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed Sep 02, 2009 9:56 am    Post subject: Reply with quote

Quote:
where will i close the cursor


which cursor?

you will get more help when you describe the scenario a 'little better'.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
badri5
Banned


Joined: 27 Jun 2006
Posts: 18
Topics: 16

PostPosted: Wed Sep 02, 2009 10:06 am    Post subject: Reply with quote

Select a from table a

where b = : b
And c = 'F'

If SQLCODE = 0----(I have to check sqlcode = 0 for fetch.But lastly close cursor will come.it will close cursor for and checking sqlcode = 0)without closing the cursor i can't go to the next select.how will i handle this

Select a
From table b
Where a = from input file
And b = 'F'
and c = 'E'
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Sep 02, 2009 10:45 am    Post subject: Reply with quote

badri5,

if you are reading the file and selecting the values from the table then you close the cursor just before you read your next key from the file

I suggest you read these two topics

http://www.mvsforums.com/helpboards/viewtopic.php?p=51990#51990

http://www.mvsforums.com/helpboards/viewtopic.php?p=51678#51678

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group