Posts

Showing posts with the label Subfile

Expandable Subfile - Example Program

Subfile: Subfiles are one of the most used concepts on IBM i.  There are three different types of Subfiles.  Load All Subfile ( Click Here to see more about Load All Subfile with an example). Expandable Subfile Single Page Subfile Message Subfile is used to display messages on the screen. Click Here to see more about Message Subfiles.  We will see more about Expandable Subfile in this article with an example. Variable has been used to display message on the screen in this example. Message subfile can be used instead. Expandable Subfile: As the name suggests Subfile is expanded (loaded) as we press the 'PAGE DOWN' Button.  Only one page (equal to the number of records mentioned against SFLPAG in DSPF) is loaded on the initial load and the next page is loaded when we press 'PAGE DOWN'.  Logic for PAGE DOWN needs to be handled in the Program and PAGE UP is taken care by the system (using the records already loaded from Subfile buffer).  However, Maximum numb...

Subfile Keywords in IBM i

Subfile Keywords: Subfiles are one of the important concepts on IBM i and widely used. Below are some of the Keywords used in Subfiles.  SFLNXTCHG (Subfile Next Change) - Used to mark the Subfile record as Modified. So that this record can be read using READC (Read Changed Record) operation in the Program. This needs to be defined in Subfile data format.  This can be used by defining Indicator against this Keyword or without defining any Indicator. Using Indicator would help programmer control the operation in the Program. Without the indicator, every record would be marked as Modified by default and READC would read every record. Click Here  to see more about SFLNXTCHG & READC. E.g.: A  50                                  SFLNXTCHG In this example, Indicator '50' can be used to control the SFLNXTCHG. Turning ON the Indicator '50' and Updating the Subfile record would modify the...

Load All Subfile - Full Free Format RPGLE

Load All Subfile in Full Free Format RPGLE Earlier in my post I shared a simple Load All Subfile in RPGLE. Click Here for this post and for more details on Subfile. In this post, we will use the same Example using Full Free Format RPGLE. Refer this link  for the Sample Physical file and Display File used in this Article. Below is the Sample RPGLE code for Load All Subfile. **Free   // Define Physical File   Dcl-F TESTFILE ;   // Define Subfile   Dcl-F TESTSUBFIL WORKSTN SFILE ( SFDTAR : SFRRN ) ;   // Define Required Variables   // Main Process   ExSr Sub_Init ;   ExSr Sub_Main ;   ExSr Sub_Exit ;   // Sub_Init - First time initialization routine   BegSr Sub_Init ;     SFPGMNAM = 'TESTLODALL'     // Clear Subfile     *In25 = *Off ;     *In26 = *Off ;     *In28 = *On ;     Write SFCTLR ;     *In28 = *Off ;     *In25 = *On ; ...