Nope. Wrote a test program and it works fine.
I’d already removed the SFLINZ code from my test just in case.
The process does a SFLCLR to the SFLCTL record. Then you just set the RRN value and WRITE on the SFL record.
I tested it with a Page at a time setup with the size set at 17. So both SFLSIZ and SFLPAG set to the same value.
I loaded them backwards, starting from 17, worked fine.
On one of the pages it only loaded up till rrn 9, leaving 1 through 8 unset, and still worked just fine.
I then tested loaded every other one starting at 15 and going down to 1.
Loading 1,3,5,7,9,11,13,15.
Works just fine.
I even have SFLRCDNBR set for cursor positioning.
A SFLRRN 4S 0H SFLRCDNBR(CURSOR)
Loading a value of 2 didn’t even generate any error. Also, the cursor appeared on line 2, even though there was not anything loaded for that RRN.
Of course you can’t CHAIN RRN SFL with a value of 2 or you get a not found.
So it “worked” if you really, really need that feature.
I’d personally just load the page from 1 to end and be done, using SQL FETCH RELATIVE to set the starting record required to display the last Page of records.
Then just run through a Fetch, write loop for the screen.
I also stay away from Full Load Subfiles if at all possible.
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Patrik Schindler
Sent: Tuesday, December 14, 2021 10:03 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Display last item of SFL
Hello Chris,
Am 14.12.2021 um 17:30 schrieb Hiebert, Chris <chris.hiebert@xxxxxxxxxxxxxx<mailto:chris.hiebert@xxxxxxxxxxxxxx>>:
Also, you can load whatever RRN you want. If you want to start with RRN 15 then load back to 1, then you can do that. Although I wouldn't do it that way.
As far as I remember, you'll be presented with an exception either when setting SFLDSP, or even when WRITE'ing to the SFL, when not…
- Starting filling of the SFL with SFLRCDNBR 1,
- Incrementing SFLRCDNBR by values greater than 1.
These two also combine to "you can't decrement SFLRCDNBR".
I always do a SFLCLR with a WRITE to the SFLCTL format. Maybe your proposal works when using SFLINZ instead.
:wq! PoC
As an Amazon Associate we earn from qualifying purchases.