Pages

Tuesday, May 26, 2020

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 Subfile record allowing it to be read using READC. 
 

SFLRCDNBR (Subfile Record Number) - Used to Specify which page of Subfile Record to be displayed. 

CURSOR or *TOP can be added to this keyword to specify where the cursor needs to be placed. 

A            CSRRRN         4S 0H      SFLRCDNBR(CURSOR)
This would point the cursor at the Subfile Input field. 

A            CSRRRN         4S 0H      SFLRCDNBR(*TOP)
This would point the cursor at the top of page. 

SFLPAG - Used to define the number of records to be displayed on screen per page. 

SFLSIZ - Used to define the total number of records within subfile. Maximum number of records allowed is 9999. 

SFLPAG & SFLSIZ can be used based on the type of Subfile. 
  • Load All Subfile - SFLSIZ can be defined as 9999. And, maximum number of records allowed is 9999.
  • Expandable Subfile - SFLSIZ can be defined with SFLPAG + 1 (E.g.: If SFLSIZ is 8, SFLPAG would be 9).Maximum number of records allowed in Subfile is 9999. 
  • Single Page Subfile - SFLSIZ would be equal to SFLPAG (E.g.: If SFLSIZ is 8, SFLPAG would also be 8). There can be any number of records added to Subfile and this needs to be handled in the program.
SFLCLR - Clears the Subfile. This can be controlled with Indicator and used to Clear the records from Subfile.

A  28                                  SFLCLR

This Indicator needs to be turned ON only to clear the Subfile and needs to be Turned OFF while writing writing the records and displaying the Subfile.


SFLDSP - Used to determine whether Subfile (Data) needs to be displayed or not. 

A  25                                  SFLDSP

This indicator needs to be turned ON only if there is a data in Subfile. And, needs to be turned OFF if there is no data in the subfile or clearing the subfile. 

SFLDSPCTL - Used to determine whether fields in Subfile Control format needs to be displayed or not.

A  26                                  SFLDSPCTL
This indicator needs to be turned ON for displaying the Subfile (even if there is no data) and needs to be turned OFF while clearing the subfile. 

SFLEND - Used to determine end of the Subfile.

A  40                                  SFLEND

By default, Subfile End would be turned OFF and '+' (or More...) sign is displayed at the end of subfile. This needs to be turned ON in the program to mark the End of Subfile and 'Bottom' would be displayed at the end of subfile.

SFLCSRRRN - Returns the RRN of the record where cursor is present. 

A                                      SFLCSRRRN(&SFLCSR)
RRN would be returned to the field defined along with Keyword which can be accessed in the Program.

No comments:

Post a Comment

Popular Posts