Hmmm, I'm not so sure it's as easy as described, at least not to do a properly stateless, RESTful API when you need to accessed paged data on the system (and I say this having written quite a few). The key word here being "stateless", because there's no concept of previous page, or next page etc., each request has to be able to ask for page "x" of the data set with no prior state whatsoever and not necessarily sequentially. I don't believe it's possible to reuse existing subfile logic to do this correctly.

Fortunately SQL can solve this problem using the LIMIT x OFFSET y clause, the following stored procedure below shows how this can be used:

create or replace procedure SP_QueryTables(
in "TABLE_SCHEMA_" varchar(10) ccsid 273,
in "TABLE_NAME_" varchar(256) ccsid 273,
in PAGE_NUM integer,
in PAGE_SIZE integer
)

language SQL
result sets 1
specific SP_QueryTables
set option usrprf=*OWNER,
datfmt=*ISO,
timfmt=*ISO

begin
declare C1 cursor with return to caller for

-- Any operations that sort, increase or decrease the number of rows selected belong here
-- (such as inner joins, one-to-many joins, the "where" clause, distinct, etc.).
with PAGED_DATA as (
select *

from QSYS2.SYSTABLES

where (coalesce(TABLE_SCHEMA_, '') = '' or TABLE_SCHEMA = TABLE_SCHEMA_) and
(coalesce(TABLE_NAME_, '') = '' or TABLE_NAME like concat(TABLE_NAME_, '%'))

order by TABLE_NAME
)

select (select count(*) from PAGED_DATA) as ROW_COUNT,
PD.*

from PAGED_DATA PD

limit PAGE_SIZE offset (PAGE_NUM - 1) * PAGE_SIZE

-- Add any left joins here...
;

open C1;

end
;;

call TIM1.SP_QueryTables('TIM1', 'TEST', 1, 10)
;;


Indeed, such a construct can be used to simplify and enhance existing subfile programs IMO, although I'm lucky enough to avoid having to write an most of the time these days 😉

Tim.


________________________________
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Alan Shore via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx>
Sent: 25 November 2019 21:22
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Alan Shore <ashore@xxxxxxxx>
Subject: RE: [EXTERNAL] Re: main difference between expandable and singlepage subfile

Can you supply code on how to do this?

Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
‘If you're going through hell, keep going.’
Winston Churchill


-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Raul Jager
Sent: Monday, November 25, 2019 3:19 PM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: [EXTERNAL] Re: main difference between expandable and singlepage subfile

Using web you can do simple pages, medium, or sophisticates. Using RPG web is very fast, you will not notice any difference in speed.

You can translate very easily a subfile program to the web, and have it similar to the green screen.

El 2019-11-25 a las 16:34, Patrik Schindler escribió:
Hello,

Am 25.11.2019 um 19:49 schrieb Raul Jager <raul@xxxxxxxxxx>:

Since a long time ago I do not have limits in sub file size, nor in the width. I have moved to the web. Highly recommended.
Depends. I'm loving text interfaces very much since they are *quick* and very clear when well designed. A browser, transferring and rendering eye-candy and more or less huge tables is often slower and invites to cram as much information in one page as reasonably possible.

Please note: I'm mostly a hobbyist user but my boss thinks alike and
so I'm developing some tools for inhouse use…

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE - https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pocnet.net%2Fpoc-key.asc&amp;data=02%7C01%7C%7C5813c43be0054967927f08d771e53249%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637103101507331516&amp;sdata=k5bLhJ8NI8awrPLm%2FjYEPWnBA%2Bm846lCzl%2BCsgYCZ8E%3D&amp;reserved=0


-- Este e-mail fue enviado desde el Mail Server del diario ABC Color --
-- Verificado por Anti-Virus Corporativo Symantec --
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fmidrange-l&amp;data=02%7C01%7C%7C5813c43be0054967927f08d771e53249%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637103101507331516&amp;sdata=j%2Be3vpl8NZFqAwtGjrLQ%2Bt%2BFmnCXqjFXNv7OSgdbZWo%3D&amp;reserved=0
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fmidrange-l&amp;data=02%7C01%7C%7C5813c43be0054967927f08d771e53249%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637103101507341509&amp;sdata=3HJxz81QhAkMdLB5fcrm80ZzHL5ul59qjxjFOMJQKBk%3D&amp;reserved=0.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Famazon.midrange.com&amp;data=02%7C01%7C%7C5813c43be0054967927f08d771e53249%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637103101507341509&amp;sdata=4YHnm0SMR2yIZuGdSOf23OGDcdaVd70gvg4J1YVONNQ%3D&amp;reserved=0
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fmidrange-l&amp;data=02%7C01%7C%7C5813c43be0054967927f08d771e53249%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637103101507341509&amp;sdata=47NKNSWzCxU8zHJRSWkrXu1%2F1ioEhlOUkXs9W6L2Uuo%3D&amp;reserved=0
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fmidrange-l&amp;data=02%7C01%7C%7C5813c43be0054967927f08d771e53249%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637103101507341509&amp;sdata=3HJxz81QhAkMdLB5fcrm80ZzHL5ul59qjxjFOMJQKBk%3D&amp;reserved=0.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Famazon.midrange.com&amp;data=02%7C01%7C%7C5813c43be0054967927f08d771e53249%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637103101507341509&amp;sdata=4YHnm0SMR2yIZuGdSOf23OGDcdaVd70gvg4J1YVONNQ%3D&amp;reserved=0

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2024 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.