1,485 pts.
 AS400
Hi all...     How to manage the PageDown and PageUp function in SFLSIZ=SFLPAG subfile..? If anybody have the sample codes for this please share it... Thanks.

Software/Hardware used:
ASKED: November 21, 2011  7:47 AM
UPDATED: March 6, 2012  6:19 PM
  Help
 Approved Answer - Chosen by Sureyz (Question Asker)

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
write 1
read 2
1<6
write 2
read 3
2<6
write 3
read 4
3<6
wirte 4
read 5
4< 6
write 5
read 6
5 < 6

wrote 6
read 7
end
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
0<6
write 8 <-- row 7 was never written

solution
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.
Phil

ANSWERED:  Nov 22, 2011  12:30 AM (GMT)  by Sureyz

 
Other Answers:

In Control format of Subfile, define pagedown along with other Function Keys. Map the PAGEDOWN with any available Indicator(Eg:- 41)
<pre>…..AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions++++++++++++++++++
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>
<pre>
/Free
Read TESTPF
Dow RecCnt <= SflPagCnt ;
//Write Records to Subfile
RecCnt = RecCnt + 1 ;
Read TESTPF ;
EndDo ;
If %EOF(TESTPF) ;
*In40 = *On ; //End of SubFile
EndIF ;
/End-Free
</pre>

Call this routine when ever Page Down is pressed.

<pre>
If *In41 = *On
LoadSfl() ;
EndIf ;
</pre>

Pradeep.

Last Wiki Answer Submitted:  November 21, 2011  8:12 am  by  deepu9321   3,370 pts.
Latest Answer Wiki Contributors:  deepu9321   3,370 pts.
To see other answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Pradeep.
Problems with your page down routing
Becuase sflsiz = sufpag this is a page-at-a-time routine
1. Must clear the Sfl
2. Should set RecCnt to 0 at beginning of routine.
3. Shoud test for EOF of TESTPF
4. if you are putting 5 records in the subfile this code reads 6 (to set the MORE indicator) loading rows 1-5 but the next page down loads rows 7-11 and row 6 is never loaded!
Phil

 44,200 pts.

 

The ILE RPG Programmer’s Guide includes a fairly complete example of a SFLSIZ=SFLPAG subfile application.

Tom

 108,310 pts.

 

Hi Phil,
thanks for correcting the errors. i was thinking to give a brief idea of how to load a page-at-a-time and missed the mentioned things.
1. Clear Routine should be called before loading the Routine and RecCnt must be intitalized.
2. Dow must be having condition for EOF.

But, I didnt get you exactly, Why the Record ’6′ will get missed.
In my example, If we are loading 6 records per page, am loading the subfile until RecCnt will become ’6′ and writing all the 6 records.
We are not increasing Record Count for Switching ON the indicator for displaying ‘More’. When ever EOF file occurs, then ‘More’ will not appear on the screen.

Pradeep.

 3,370 pts.

 

And we still haven’t addressed the pageup!!!
Phil

 44,200 pts.

 

Lots of explanations and examples in the manuals
and lots of chunks of code on the ‘net that you can modify,

Google is your friend…

.

 5,505 pts.