Pages

Sunday, November 27, 2016

How to create a Subfile program without using any native I/O operations.



How to create a single page Subfile just using embedded SQL. 


Every RPGer knows about subfiles. So, in this post I am not going to describe you “what is a subfile” or “what are the three types of subfiles”.

One day a friend asked me “is it hard to create a single page subfile just using SQL and also with a search option?” He was though managing ‘Page up’ and ‘Page down’ would be difficult when using SQL. But it’s not. I have done it easily using a scrollable cursor. 

Subfile

There are two main differences in my single page subfile program than many other single page subfiles on the internet. Those differences are,

  1. There are no any native I/O operations, It’s just SQL.
  2. There are no any numeric indicators.
Here I’m using simple search with one search criteria. But if we want to use more complex search criteria, then we might have to use dynamic SQL instead of Static SQL.
If anyone wants to re-use this program with a different file and a selection, then he/she has minimum changes to be done (Just change SQL selection and “dsp_fields” data structure). Following are the codes. Even you can download them from here.