If you are loading reading and loading 6 you will not have the MORE indicator set right.
But your logic gets the indicator correct.
You have an
initial read record 1
0 < 6
5 < 6
set more indicator
Actually your routine runs the first set fine but when the page down key is pressed it
starts with a read 8
write 8 <-- row 7 was never written
the primary or priming read should only occur when loading the first page
so it's placed in the initial code before calling the routine. PgDn inicator doesn't read a record, it runs the routine which now starts with the do and write.
Page up key .. a bit heaver code.
In Control format of Subfile, define pagedown along with other Function Keys. Map the PAGEDOWN with any available Indicator(Eg:- 41)
A CF12(12 ‘PREVIOUS’)
A N40 PAGEDOWN(41 ‘PAGEDOWN’) </pre>
We must be handling PageDown Operation in our program using Indicator ’41′. Indicator ’40′ indicates End Of Subfile.
In Case of SFLPAG = SFLSIZ subfile,
In every attempt we will be loading only ‘SFLPAG’ number of records at a time.
When Page down is Pressed, The consequent records(equal to SFLPAG) will be loaded into Subfile.
At the End of the Subfile we will need to Switch ON Indicator ’40′.
The Sample code will be like below.
<b>Subfile Load Routine</b>
Dow RecCnt <= SflPagCnt ;
//Write Records to Subfile
RecCnt = RecCnt + 1 ;
Read TESTPF ;
If %EOF(TESTPF) ;
*In40 = *On ; //End of SubFile
Call this routine when ever Page Down is pressed.
If *In41 = *On