Hopefully I have remembered to include everything of import here. I didn’t include things like command key handling. You’ll obviously have to fill in the blanks. But having coded on this platform for 27 years (I can’t believe it!), I’ve found this to be a tried and true basic technique.
If you plan to load from a point in the data and be able to page down, use this technique. You can make it go back and forth, but I’ve found my users were quite satisfied with this method.
Note, If you aren’t allowing the user to select a subfile record and process it, you don’t need to save the relative record number or file keys. In that case, use READP after the end of the fill loop to position to the correct record for the next subfile page and skip the setll on pagedown.
– Specify PAGEDOWN keyword with a response indicator
– Specify SFLEND keyword conditioned with a file read indicator
(I don’t normally use file access indicators, but in this case it works well)
– Specify a position to field on your subfile control record
– Execute your format
– Check to see if the position to field is changed.
– If so, clear the subfile and using the position to field key(s), setll to your file, execute fill subroutine
– Did they page down?
– If so, setll with saved keys and restore your saved subfile relative record number, execute fill sub.
– Did they select a subfile record?
– If so, using the keys from the selected record, retrieve your data base file, do whatever you do…
(This changed the file keys and the relative record number. That’s why you save them.)
– End of loop
Eval a counter to 0 (this is used to fill to the number of records on one page – we’ll pretend it’s 14)
Read with an eof indicator (we’ll use 99)
Dow not *in99 and counter < 14
add 1 to subfile relative rec#
set on subfile dsp indicator
write subfile detail record
add 1 to counter
read with indicator 99
save your last file position keys
save your subfile relative record number
-Normally I never use an indicator on a read. But the indicator 99 is turned on when actual end of file is reached. That will stop the + or *MORE from showing on your subfile at the proper time.)
Great work LeslieL
here’s a site you should check out