There is never a good reason to load 30,000 (or even 9999) records into a
subfile. Can we say never for this situation? I think so.
It sounds like the real issue is that you might select or change some
records that aren't contiguous before pressing Enter (and thereupon
processing the options).
If so, we have 25 year old RPG programs that handle this situation. They use
arrays to keep track of the key fields and present the correct records to
the PROCES subroutine upon Enter. I think someone suggested data
queues...user spaces or a work file could do the same.
Basically like this...
Load one page
Read by key
Save key, option, or other changed field in hidden field on subfile.
check array (data queue, user space or work file) for KEY. If found, eval
Option field to option (or change field to changed value).
While loading, save first key and last key for paging (although
technically not required if you just read or readp (2 times subfile size and
reload).
Display subfile.
GetOptions()
ReadC
if option changed from hidden field and hidden field is default--(new
request)..
write key and option to array (...)
if option changed from hidden field and hidden field is not default--(ie
changed my mind about what option to invoke)
search for key in array and update option
ProcessAidKey()
When pageup (page up, down, position to).
When key = Enter
Read array and do options.
If no error,
Delete array entry
Else,
Display subfile starting with error option at top of screen and
message saying 'Fix error to continue update'.
One thing to watch out for in large data sets and page at a time is the
placement of setll/setgt. It seems to me that when I'm called upon to write
something like this, the file usually is not keyed sufficiently for
uniqueness. This requires some thought and once or twice I had to get
creative in how I kept track of my place in the file (I know one program
involved tracking the relative record number (hidden field in subfile) and
making sure I was there before I starting reading again to fill the new
page.).
If you use the input file only for reading the data (and do your updates to
another file), it is easier to keep track of cursor position (shouldn't need
setll except for position to).
Mike Krebs
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of J Z
Sent: Friday, September 07, 2007 3:25 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: RPGLE DDS Subfile out of 9999 records limit
Hi,
As you know that IBM restricted to the 9,999 records limit when load a
subfile, and we can just load one page at a time to not limited by the
number of records.
But I have a situation that need to load all data (almost 30, 000 records)
into subfiles, and allow user to do page down, page up to select/change
multiple records. I can do the page down & page up, but how can I get my
selected data 'cause the original SFLRCDNBR can only up to 9999 ?
Any hints, suggestions or sample codes would be really appreciated!
JJ
--
This is the RPG programming on the AS400 / 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.