What I do to acheive the page down is that I use 2 cursor.
For page up:
exec sql declare cur_next cursor for
select field1, field2
from file
where KeyField > :@keyfield
order by KeyField asc
fetch first 30 rows only;
For page down:
exec sql declare cur_previous cursor for
select field1, field2
from file
where KeyField <= :@keyfield
order by KeyDield desc
fetch first 30 rows only;
The trick is in the ORDER BY clause where I specify "asc" or "desc" for ascending or decending
Denis Robitaille
Chef de service TI
Cascades Centre des technologies,
une division de Cascades Canada ULC
412 Marie Victorin
Kingsey falls(Québec) Canada J0A 1B0
T : 819 363 6130
-----Message d'origine-----
De : RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Booth Martin
Envoyé : 13 novembre 2015 03:57
À : RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Objet : embedded SQL fetch relative -29 ...
Using SQL, I can page ahead in a page-at-a-time subfile easily but when it comes time to page down, I believe the best way is for me to use fetch retrieve - (2 pages +1). The few examples I have been able to find seem correct and to the point, but I can not make them work. I am missing something.
Can someone point to a good example somewhere that I can look at?
--
Booth Martin
www.martinvt.com
(802)461-5349
Brady's First Law of Problem Solving: When confronted by a difficult problem, you can solve it more easily by reducing it to the question, "How would the Lone Ranger have handled this?"
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.