Expandable subfiles in RPGLE
An expandable subfile is one in which ideally one page of records are loaded at a time. Subsequent pages are added to the subfile as per the user demand.
In the expandable subfile the subfile size must be at least one greater than the page size.
The ILE RPG program to process an expandable subfile has typically the following flow
1. Load the subfile: Initially the only the first one page of the subfile is loaded.
2. Display the subfile: The subfile screen is displayed to the user.
3. Rollup: Check if user pressed the rollup key. Many a times no rollup is defined and the next page is loaded with ENTER (RETURN) key only. If ROLLUP key has been pressed, load the next page and display it.
Note: In expandable subfiles, we do not need to handle ROLLDOWN. This is handled by the system itself. This is because we do not clear subfile before loading the next page. The next page records are simply added to already existing first page.
Want to see the code?
RPG Programming for Beginners
RPG is the well known programming language on the IBM i platform. Earlier versions of RPG ran on the old AS/400 and iSeries machines in decades gone by… the beauty of RPG is that it is fully backwards compatible. But, over the years RPG has evolved massively!