What is a single page subfile?
A single page subfile is a SCREEN OF DISPLAYED DATA, loaded one page at a time.
The displayed data is the number of records that are loaded and displayed at a time. In other words, in a single page subfile, all loaded records are displayed at a time. We delete all previously loaded records from the subfile whenever we need to load the next page of the subfile.
A single page subfile is characterized by the subfile size equaling the page size. Also, in a single page subfile, both ROLLUP and ROLLDOWN keywords must be defined in the DDS of the subfile control format.
This is because the PAGEUP/PAGEDOWN activities are handled by the program
Jump into this free lesson to see code examples, RPG programming styles and a video walk through helping you to master RPG SINGLE PAGE SUBFILES:
Example Single Page Subfile in SQL RPGLE
Learning Something New
“I am always ready to learn although I do not always like being taught.” — Winston Churchill
- All courses…
- Topics
- Modernization
- IBM i | AS400 | iSeries
- WordPress
- Access restrictions
- MEMBERS ONLY
- Free For All
51 Lessons – Easy
Not started
RPG Programming for Beginners.
Aimed at programmers that have (a) no knowledge of the RPG ILE language or (b) knowledge of older RPG versions and want to upgrade to modern ILE Web powerful RPGLE.
Hi Nick,
Does your IBM i RPG Subfile program run in OS version V5R4 , because I’ve got several highlighted lines in the source code ?
Thanks in advance.
Ummm, I don’t know! V54R end of service was back in 2013… I can’t remember if the old version of IBM i supported fully free format RPG? Did you try it?
Not likely Laurent as new features of free format RPG at V7R1 won’t be supported by V5R4.
Hello Nick.
This is a very good example.
If you have this program with add and update?
Thanks, Mic
I do. This code is several years old and I’ve used it in various update scenarios since then… I will rustle together the update example and post it ASAP.
and/or a dynamic-ORDER BY clause.
Example is when you have multiple of input fields as key-fields when starting to sort, and when these input fields (on the CTL-record-format) have changed it’s values.
Maybe an exec-sql PREPARE is necessary?
Please advise. Thank you.
Hello Nick! I stumbled upon your free-format RPG and embedded SQL from your website, about single-page subfiles.
I like your coding style! Thank you! …
By the way, do you have code-snippets or logic where the program/dspf requires a “Position To”?
Thanks again!
Why waste indicators on function keys andPageUp/Down… just use the AID byte.
I used to use the DSPF AID byte all the time – but for when creating simple examples I find the mapping the *indicator array a clearer way to explain the function keys. It could, of course, be argued both ways. Both just as good as each other. 🙂
If you need two elseif statements… I would recommend select/when/endsl which is easier to read.
Again, agree totally. But.. in this code example I was writing it and showing it to a .net programmer that preferred if/elseif/elseif layout… so his preference just kind of stuck with me. 😉
When I’m writing my own code I tend to use *SELECT* groups in both RPG and CLLE because I like the indentation layout of them… seems cleaner to my eyes.
Argh! I didn’t have **FREE starting in position 1. Now it compiles fine. Sorry for the dumb comments above. I can’t seem to delete my comments.
Deleted for you! 😉
that doesn’t even look like rpg….pretty slick.
Thanks Nick, very interesting and ussefull.
Hello Nick, I found this in doing some research for a project I have and thought it might help but have some issues I can’t seem to resolve.. My project is to display a subfile that can be up to 3 pages long during the day. – It will grow as production grows. There is a program that runs all day that updates the production work file that this program should display. I want it to display a page at a time, pause for X seconds, display the next page, if there, pause, etc. There are no updates, inqs, etc. This is just a display for the shop floor. I’ve tried sleep, dly, %status. Can’t seem to get it. Can you help me? Thanks,
Hey Janet
Sorry this reply is a couple of months old — I suspect you already solved this problem?
If not, then I’m going to write a blog on how to do this later today. It’s actually an easy solution using record timeouts in the DDS. I’ve written a few things that do exactly this over the years.. will be fun to revisit an old piece of code and modernise it for an example. Watch this space!!!