Chapter 12

March 25, 2018 | Author: Rahul Jaiswal | Category: File Format, Reserved Word, Computer File, Software Engineering, Areas Of Computer Science


Comments



Description

RPG IVInteractive Programs: Advanced Techniques - Chapter 12 Objectives Use Subfiles Use on-line help Subfiles A collection of records that is handled as a unit for screen I/O Subfiles consist of the Subfile Record Format and the Subfile ControlRecord Format . which identifies this format as a subfile . SFL(subfile).Subfile Record Format The subfile record format describes the fields that are to appear on the screen A new record-level keyword is required. Subfile Control-Record Formats The subfile control-record format must immediately follow the subfile record format This record format controls the display of the subfile records through the use of special record-level keywords Column headings are also included in this record format . Subfile Control-Record Keywords SFLCTL SFLDSP SFLSIZ SFLDSPCTL SFLCLR . Loading the Entire Subfile Define the subfile size large enough to hold the maximum expected number of records Easiest to code but results in the slowest initial response time Once the display begins. however. paging through the subfile is fast . Loading the Entire Subfile(cont.) This method is least appropriate when there are large number of records to be loaded and the user is likely to want to see most of them SFLSIZ must be large enough to hold all the data . File Spec Modifications Code SFILE in the Keywords area Code the subfile record format name. a colon. and the field to be used to store the relative record number as parameters . the system will handle any user request to roll up or roll down Upon return the program should either end or request another course .Logic for loading Entire Subfile Chain to the file and write them to the subfile Load the subfile until there are no more records Then the subfile can be displayed by executing the subfile control-record format Because SFLPAGE is less that SFLSIZ. as your program adds more records to it When the user attempts to roll up past the last page in the subfile. however. control returns to the program.Loading Subfile Page at a Time Variation #1. regardless of its stated size.Subfile one greater than page Subfile Size One greater than Page The system will automatically expand a subfile. which must load an additional page . and control is not returned to your program for additional loading . the + sign is not displayed.Loading Subfile Page at a Time Variation #1 . the system displays a + sign and returns control to your program to load the next page If the SFLEND indicator is on.Continued ROLLUP keyword must be associated with an indicator to allow the system to send control back to the program You must also add the SFLEND keyword If the SFLEND indicator is off. Continued Thus your program should turn on the SFLEND indicator when no additional records remain The third keyword needed is SFLRCDNBR coded within the subfile control-record format opposite a hidden field The value of the hidden field determines which page of the subfile is displayed .Loading Subfile Page at a Time Variation #1 . if the return was triggered by the roll key.Logic for Variation #1 Each time control returns to the program from the screen. the program should turn on the SFLEND indicator to disable rolling past the last subfile page . the program must load the next page of the subfile and return back to the screen When there are no more records left to load. that is one page .Logic for Variation #1 cont. the program needs to read one additional record after loading an entire subfile page before displaying the new page The load subroutine only writes out 15 records to the subfile. To determine whether additional pages can be built. Loading Subfile Page at a Time Variation #2. this method builds the subfile just a page at a time. like variation #1.Subfile much bigger than page This method of building subfile a page at a time. instead of putting all the appropriate records in the subfile prior to any display . is really just a variant of loading the entire subfile at once However. setting size much bigger that page. Loading Subfile Page at a Time Variation #2. because the large specified size allocates adjacent disk space for faster access You should probably not use this method if the expected subfile exceeds 100 records .Continued This method is appropriate when a large number of records need to be stored in a subfile. Loading Subfile Page at a Time Variation #2 .Continued In the display file. you merely need to change the subfile size ad move ROLLUP keyword from the subfile control-record format to the subfile record format The program logic is the same as Variation #1 . because rolling backward requires replacing the existing page with records already read. program logic required by this technique is more complicated .Loading Subfile Page at a Time Variation #3.Subfile size equals page Setting subfile size equal to page is most appropriate when the user is likely to want to roll through a large number of records Rolling forward requires replacing the existing page with the next page through loading. Subfile size equals page With this method.Loading Subfile Page at a Time Variation #3. the subfile stores only one page of records As an alternative to enabling ROLLDOWN. programmers require users to restart the subfile at the beginning In the DDS the subfile size equals page and keyword SFLRCDNBR is not used . the subfile must be cleared.Logic for Variation #3 First. the program must check the roll-key indicator and indicator 04 upon return from the screen to determine whether to build the next page of the subfile or to restart at the beginning of the subfile . before each loading of the subfile. since the new records should completely replace the previously displayed records Second. Subfiles and Change READC (Read next Changed record) Used only with subfiles Used in a loop. reads only those records from a subfile that have been modified during a prior EXFMT operation Subfile fields need to have different names than the database Change usage on fields to B in the display . to enable the Help key . you need to include the keyword HELP.On-Line Help Help is evoked by pressing the HELP key The help text may reside in an Office Vision/400 document. in records within a separate display file. at either the file or records level. or as records with the display file used in the interactive application First. pressing it will display help information associated either with the entire display or with a specific area of the display For the entire display. coupled with the name of the record format containing the help text .Global Help With the Help key enabled. you need in addition to the keyword HELP. a filelevel keyword HLPRCD. if the cursor is within this area and the user presses the Help key. the help text is displayed In addition to the HLPARA.Cursive-Sensitive Help The HLPARA (Help area) associated with the help specification defines a rectangular area on the screen. the help specification includes keyword HLPRCD to designate which record should be displayed . that actually manages the displaying of the subfile information .Points to Remember To define subfiles within DDS requires two kinds of record formats One that defines the fields within the subfile and describes the field locations within a screen line And a second format. called a subfile control-record format. Points to Remember cont. while record-level keyword SFLCTL identifies a format as a subfile control-record format . Several required keywords are used with subfiles Record-level keyword SFL identifies a record format as a subfile record. Several different techniques exist for loading and displaying subfiles The AS/400 allows you to associate on-line help with an entire screen or with specific areas of the screen that the user can access through the Help key .Points to Remember cont.
Copyright © 2024 DOKUMEN.SITE Inc.