I like the ability of the subfile to process through multiple pages of selection, using a straight read cursor to populate it, and not having to do a lot of programming for paging up. To solve the subfile limit, in case the user hold down on the page down key, I wrote a routine to copy the records I wanted to keep to an array, clear the subfile and write the records back in a different position, basically shifting the contents of the subfile using an array. The logic is short, so I'm pasting it here. The one disadvantage is that if the user makes some selection on the records that will be lost, I take no action on that selection, but, that selection was quite a few records back after the page down key, so, I've had no complaints so far.
dcl-c MaxSF 9999;
dcl-c sflpag 13;
if RRN1 + sflPag*2 > MaxSF;
callp $ScrollSF1(lstrrn:sflpag*15);
endif;
//**************************************************************
dcl-proc $ScrollSF1;
//**************************************************************
dcl-pi *n;
lstrrn like(RRN1) const;
IncAmt uns(5) const;
end-pi;
dcl-ds SFDS extname('UR5017D':'SFL1':*all) dim(MaxSF) qualified INZ;
end-ds;
dcl-s idx1 uns(5);
//************************
for idx1=IncAmt+1 to lstrrn;
RRN1=idx1;
chain RRN1 SFL1 SFDS(idx1-IncAmt);
endfor;
callp $clrsf1();
clear RRN1;
for idx1=1 to lstrrn-IncAmt;
RRN1+=1;
// Set change flag for READC
if SFDS(idx1).OPTION<>*blanks;
*in30=*on;
else;
*in30=*off;
endif;
write SFL1 SFDS(idx1);
endfor;
return;
end-proc $ScrollSF1;
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of techie21 IT
Sent: Saturday, April 4, 2020 4:34 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Regarding significance of subfiles
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Hi,
Is single page subfile best subfile to avoid limit of number of records to be displayed?
Thanks
--
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@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.