Hi Gio,

with only that much code, I can only give some ideas.

a) is there an ORDER BY clause? If not, every execution of the statement can generate an other sequences of rows.

b) is the cursor open during calls? And is the cursor INSENSITIVE? If not, new rows can show up in the next fetch, disturbing the sequence you might assume.

c) OFFSET is generally a bad idea for pagination
-> https://use-the-index-luke.com/no-offset

Can you send the whole SQL statement and especially the cursor definition?

HTH
Daniel


Am 10.02.2026 um 15:25 schrieb gio.cot via RPG400-L <rpg400-l@xxxxxxxxxxxxxxxxxx>:

Hi all

I have a problem with a Web Service, invoked via server windows to display
a item inventory grid. I try to explain: the RPGLE SQL program that return a
Json file, is setted for return 60 rows for time ; in RPGLE we have coded :

' OFFSET ( ' + %char(PagNum) + ' - 1) * 60 ROWS '

' FETCH NEXT 60 ROWS ONLY '

' with NC '

' FOR READ ONLY ';

it happeds that after the fetch from the cursor , the RPGLE program, for
some required rules , skip some row, and so the Json file doesn.'t contains
60 rows but 51 or 52 .. etc etc.

my questioni s : how can force (if its possible) the fetch cycle to fill the
json file with the 60 rows, also if i need to read from my cursor more than
60 rows ??



I hope my explanation was clear

Thanks in advance

Gio

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.