Search code examples
ibm-midrangerpgle

Detecting page down and page up key presses in a Load all subfile


An additional requirement has come up for a load all subfile that I created. The subfile control record format has few input fields which are validated when the user presses Enter. Then if the input parameters are found to be valid, records from a database file satisfying the input parameter values are displayed as the subfile records.

The new requirement is that, if the user presses page down or page up after changing the input field values but without pressing Enter, the input field values should be revalidated and the subfile records refreshed as per the new parameters supplied.

Is this technically possible? As the subfile is a load all one, the page up or page down key presses will not pass control back to the program as the paging is handled by the OS.Hence I cannot see a way how the parameters can be revalidated. Is there a way to pass control back to the RPG when Page up or Page down is pressed and at the same time,l make the OS control the paging?

Any suggestions, please?


Solution

  • You are correct, the program would not get control back until the user paged all the way to the beginning or end of the subfile in an extendable subfile (SFLSIZE <> SFLPAGE). But if you used a page at a time subfile (SFLSIZE = SFLPAGE) then you can return control to the program for every PAGEUP/PAGEDOWN key press. This will change the structure of your program a bit, but you should be able to get it to work without too much trouble.