09- RPGLE - Subfiles

DURATION:
12 Hours
ID:
09
?>
PRICE
3,000.00

INSTRUCTORS:

Mrs.Lalitha
Chief Trainer - AS/400 Expert

Categories

Advanced

This module covers detailed explanation of using subfiles in RPGLE programs. Covers the different types and usage of those subfile types. Also covers different ways of loading the data to the subfile.

Subfiles:

Subfiles are used to display and/or manipulate multiple records of the same type at a time. A subfile is a group of records that can be displayed on the screen using one write operation. The user is allowed to modify/enter new data and the same group of modified records can be read from the screen into the program using one Read operation. 

Subfiles are designed through SDA and can be created by coding DDS directly and it creates two record formats in the DDS namely Subfile Record format and Subfile Control Record format.

Subfile usages:

Subfile for Inquiry:   Used to display group of records. Used only for display purpose.

Subfile for Inquiry with Selection:  Used to display group of records and the records can be manipulated by calling other programs

Subfile for Inquiry with Update:  Used to display and manipulate group of records through the subfile.

Subfile for Data Entry: A blank subfile using which multiple records can be inserted.

Subfile for Data Entry with update: Existing records will be displayed on the top of the subfile and set of blank records will be displayed once all existing records are displayed. Existing records can be modified and new records can be inserted through this type of subfile.

Subfile Record: Contains fields which are used to display the data of group of records on the screen and to read the data from the screen into the program.

Subfile Control Record: Controls the subfile record like  how many records to be displayed in a page, when to display the subfile records, how much memory to be allocated for the subfile initially, etc. The control record controls the subfile record by using some keywords.

Subfile control Record Keywords:

  • SFLCTL names the associated subfile (SUBFIL).
  • SFLCLR indicates when the subfile should be cleared.
  • SFLDSPCTL indicates when to display the subfile control record.
  • SFLDSP indicates when to display the subfile.
  • SFLSIZ indicates the memory for total number of records to be included in the subfile initially.
  • SFLPAG indicates the total number of records to be displayed in a page.
  • SFLEND indicates whether More(+) or Bottom(Blank) to be displayed.

Sample DDS of a Subfile:

Subfile Tasks:

  1. Loading – Loading data from the database file to the subfile memory
  2. Displaying – Displaying one page of records
  3. Processing – Processing the records from the subfile memory and update back to the database file depending on the type of subfile.

Types of Loading the subfile:

  1. Load All – Loading all the database records at once into the subfile memory. PGUP and PGDN will be automatically handled by the system.
  2. Load on Demand – Loading one page of records and appending additional pages on request by the user. PGUP is handled by the system and PGDN should be handled by the programmer to load the next page
  3. Load Single Page – Load only one page at any point of time. Both PGUP and PGDN will be handled by the programmer.

 

Sample RPLGE program:

Need more information about all the types of subfiles and all types of loading the subfiles? Get enrolled to our course to do deep dive into the subfile.

Leave a Reply

Your email address will not be published. Required fields are marked *