Here is the way that I define things:

D #rrn10 s 4s 0 // current RRN - controls subfile
dsp
D #trn10 s 4s 0 // subfile page first rec
D #lrn10 s 4s 0 // subfile last rec
d #srn10 s 10i 0 // save rec # for redisplay

My display loop looks like this:

Clear_Subfile();
Build_Subfile(); // 1 page only

Dow not *INKC;

Write control_rec; // top of screen with subfile
Write err_control_rec; // bottom of screen - contains Fkey and errs
msg
Read control_rec;

Select;
When *inkc; // user indicates program termination
Iter;
When *in15; // a function key was pressed
Display_message('* Invalid Function Key');
When *in16; // subfile displayed flag - if off subfile was not
displayed
Process_subfile(); // look for changed subfile records
Endsl;

Enddo;

The Clear_Subfile procedure does what it says and set the file to the
first record.

The Build_subfile procedure also does what it says by setting #rrn10 to
the last record number saved in #lrn10. #RRN10 is increment as records
are added to the subfile. At the end of the page, the procedure sets
#trn10 to the saved last record #lrn10 + 1 which is now the top of the
new subfile page. The #rrn10 is set to #trn10 so that when the screen is
displayed, the first record displayed in the subfile is the first new
record. It also sets the other rrn fields so that it can pickup where it
left off when the pagedown button is pressed.

When the Process_subfile routine is executed, each time the READC is
executed and no end of file is encountered, the #srn10 is set to #rrn10.
This way when all changed records are processed, the subfile is rebuilt
and the #rrn10 is set to #srn10 so that the screen displays the page
with the last changed record. This requires that the build_subfile
routine is called repeatedly until #rrn10 is >= #srn10.

You said that the subfile after each pagedown displays the first record.
That tells me that you might not have set the subfile to display based
on the SFLRCDNBR like this:

A #RRN10 4S 0H SFLRCDNBR(CURSOR)

I think this might be the solution to your problem.

Hope this helps.

Marvin

-----Original Message-----
From: Alan Shore <ashore@xxxxxxxx>
Sent: Apr 15, 2011 10:15 AM
To: "'midrange-l@xxxxxxxxxxxx'" <midrange-l@xxxxxxxxxxxx>
Subject: ~

Hi everyone
this may be a situation where I cannot see the wood for the trees (at
least - that's what I hope it is)
Whenever I need to create a subfile program, I use a template and create
a page-at a time subfile. This particular case, I can guarantee that
the limit of 9,999 records being displayed will NOT be reached, so I
decide to do a load all subfile. My SFLSIZ is larger (13) than my
SFLPAG(12) and I have no problems in displaying the data EXCEPT when I
reach the end of the display. My SFLEND(*MORE) is operating as
expected. The only problem is that when I press the Page Down key, it
starts from the beginning I expected it to NOT move and give me an error
When I start from the beginning, and press Page Up, nothing seems to
happen, but at the same time, I do not receive an error. Anyone have
any ideas?


Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxx
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill

This thread ...


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

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