Re: Help with RPGLE SQL FETCH NEXT

Luca Giammattei <[email protected]> Tue, 10 Feb 2026 16:09:38 +0100
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
Il 10/02/2026 15:25, gio.cot via RPG400-L ha scritto:
> 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
> 

Be aware of cursor definition, sensitive vs insensitive could make a big difference.
-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.