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 

need help in forward & backward scroll cursor

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


Joined: 12 May 2006
Posts: 10
Topics: 6
Location: india

PostPosted: Wed Feb 18, 2009 1:58 pm    Post subject: need help in forward & backward scroll cursor Reply with quote

hi

i am using the following cursor for displaying the values in my online screen for the first time

SELECT A,B,C FROM XYZ
ORDER BY A,B

any one can help me how to write forward and backward scrolling cursor for this

thanks,
ram
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 Feb 18, 2009 3:47 pm    Post subject: Reply with quote

rameshb,

Please search before posting. Check this link. This link shows reading from a TSQ , you need to implement the same logic to DB2 cursor

http://www.mvsforums.com/helpboards/viewtopic.php?t=3071&highlight=pageup

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
rameshb
Beginner


Joined: 12 May 2006
Posts: 10
Topics: 6
Location: india

PostPosted: Wed Feb 18, 2009 10:18 pm    Post subject: Reply with quote

hi kolusu,

i mean i need sql query

select from a,b,c from xyz
where (x = :tempx and y>:tempy) or (x>:tempx)

whether this query will work to fetch next set of records in forwaard cursor

thanks
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: Thu Feb 19, 2009 11:44 am    Post subject: Reply with quote

rameshb,

Code:

Select A
      ,B
      ,C
 from table
where A >= :host-variable-a
  and B >= :host-variable-b
ORDER BY A,B



Beginning of the program you would and open the cursor

Code:

 Move low-values TO host-variable-a
                    host-variable-b


in case of page down or forward and open the cursor

Code:

 Move last-screen-value of A  TO host-variable-a
 Move last-screen-value of B  TO host-variable-b


in case of page up or backward and open the cursor

Code:

 Move first-screen-value of A  TO host-variable-a
 Move first-screen-value of B  TO host-variable-b


Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Tue Feb 24, 2009 12:07 pm    Post subject: Reply with quote

Isn't this the right situation to use scrollable cursor?
Back to top
View user's profile Send private message Send e-mail
srini_igsi
Beginner


Joined: 12 May 2006
Posts: 41
Topics: 16
Location: Mumbai

PostPosted: Fri Mar 20, 2009 7:54 am    Post subject: Reply with quote

Hi Kolusu,

Is there a way to implement the similar logic with a DATE field in the where caluse but with duplicate values.

I believe we must have at lease one unique field on the screen/DB to control the paging otherwise we can't implement this logic using the SQL queries. The other way around is TSQ.

Please correct me if I'm wrong.
_________________
Thanks,
-Srini
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Fri Mar 27, 2009 1:38 pm    Post subject: Reply with quote

Looks like with scrollable cursor you don't have the issue.
Back to top
View user's profile Send private message Send e-mail
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