The following illustrates WORKSTN subfile processing (display only). Subfiles are used to display all matched records for a specified zip code.
CUSMSTL2: DDS for a Logical File
DDS for logical file CUSMSTL2
The DDS for the database file used by this program describe one record format: CMLREC2. The logical file CUSMSTL2 keyed by zip code is based on the physical file CUSMST, as indicated by the PFILE keyword. The record format created by the logical file will include only those fields specified in the logical file DDS. All other fields will be excluded.
SZIPMENU: DDS for a Display Device File
DDS for display device file SZIPMENU
The DDS for the SZIPMENU display device file contains six record formats: HEAD, FOOT1, FOOT2, PROMPT, SUBFILE, and SUBCTL.
The PROMPT record format requests the user to enter a zip code. If the zip code is not found in the file, an error message is displayed. The user can press F3, which sets on indicator 03, to end the program.
The SUBFILE record format must be defined immediately preceding the subfile-control record format SUBCTL. The subfile record format, which is defined with the keyword SFL, describes each field in the record, and specifies the location where the first record is to appear on the display (here, on line 9).
The subfile-control record format contains the following unique keywords:
The OVERLAY keyword defines this subfile-control record format as an overlay format. This record format can be written without the OS/400 system erasing the screen first. F4 is valid for repeating the search with the same zip code. (This use of F4 allows a form of roll down.)
SCHZIP: RPG Source
Source for module SCHZIP
The file description specifications identify the disk file to be searched and the display device file to be used (SZIPMENU). The SFILE keyword for the WORKSTN file identifies the record format (SUBFILE) that is to be used as a subfile. The relative-record-number field (RECNUM) specified controls which record within the subfile is being accessed.
The program displays the PROMPT record format and waits for the workstation user’s response. F3 sets on indicator 03, which controls the end of the program. The zip code (ZIP) is used to position the CUSMSTL2 file by the SETLL operation. Notice that the record format name CMLREC2 is used in the SETLL operation instead of the file name CUSMSTL2. If no record is found, an error message is displayed.
The SFLPRC subroutine handles the processing for the subfile: clearing, filling, and displaying. The subfile is prepared for additional requests in subroutine SFLCLR. If indicator 55 is on, no action occurs on the display, but the main storage area for the subfile records is cleared. The SFLFIL routine fills the subfile with records. A record is read from the CUSMSTL2 file. If the zip code is the same, the record count (RECNUM) is incremented and the record is written to the subfile. This subroutine is repeated until either the subfile is full (indicator 21 on the WRITE operation) or end of file occurs on the CUSMSTL2 file (indicator 71 on the READE operation). When the subfile is full or end of file occurs, the subfile is written to the display by the EXFMT operation by the subfile-control record control format. The user reviews the display and decides whether:
In Figure, the user enters a zip code in response to the prompt.
’Customer Search by Zip’ prompt screen
The subfile is written to the screen as shown in Figure.
’Customer Search by Zip’ screen
IBM - RPG Related Interview Questions
|IBM-ILE Interview Questions||IBM Informix Interview Questions|
|IBM DB2 Interview Questions||SQL Database Interview Questions|
|IBM AIX Interview Questions||SQL Interview Questions|
|AS400 Interview Questions||DB2 SQL Programming Interview Questions|
|IBM Integration Bus Interview Questions||Synopsys Interview Questions|
|Rpgle Interview Questions|
Ibm - Rpg Tutorial
Overview Of The Rpg Iv Programming Language
Rpg Programming In Ile
Program Creation Strategies
Creating An Application Using Multiple Procedures
Using Source Files
Creating A Program With The Crtbndrpg Command
Creating A Program With The Crtrpgmod And Crtpgm
Creating A Service Program
Running A Program
Calling Programs And Procedures
Rpg And The Ebusiness World
Obtaining A Dump
General File Considerations
Accessing Database Files
Accessing Externally Attached Devices
Using Workstn Files
Example Of An Interactive Application
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.