190 likes | 535 Views
Advance RPG. Chapter 12 Subfiles. Subfiles. Collection of records that is handled as a unit for screen input/output (I/O). Deals with displaying multiple records. Last chapter: Entered a section number and then display info about the section.
E N D
Advance RPG Chapter 12Subfiles
Subfiles • Collection of records that is handled as a unit for screen input/output (I/O). • Deals with displaying multiple records. • Last chapter: Entered a section number and then display info about the section. • This chapter: Enter a course number and display all sections offered.
Subfiles • Additional records layouts in DDS • One to define a subfile record (subfile record format) • One to control the subfile and its display (subfile Control format)
Subfiles • Subfile Record Format: • Describes the fields that are to appear on the screen. (If same as PF you can REF) • Must have SFL in record level keyword • Subfile Control Record Format: • Must immediately follow the above. • Controls the display of the subfile records through the use of special record-level keywords.
Subfile • Subfile Control Record Format: • SFLCTL: (Control) Identifies a record as the subfile control record for subfile named. • SFLDSP: (Display) If keyword is active, subfile will display when control record format is displayed. • SFLPAG: (Page) Defines how many records are displayed at one time on the screen. • SFLSIZ: (Size) Should be => SFLPAG. System will handle paging if it exceeds one screen.
Subfile • Subfile Control Record Format • Optional Records Level Keywords: • SFLDSPCTL: (Subfile Display Control) enables the display of any output fields or constants described within the control record format. • SFLCLR: (Subfile Clear) If active the subfile is cleared of all records displaying. Indicator is required for this.
Subfile Loading Techniques • Loading the Entire Subfile • Loading the Subfile a Page at a Time • Variation 1: Subfile size one > than page • Variation 2: Subfile size much bigger than page • Variation 3: Subfile size = page
Subfile Loading Techniques • Loading the Entire Subfile • Size is set to hold the maximum number of records, all records are loaded into the subfile before anything is displayed. • Easiest to code, but you have the slowest initial response. Subsequent paging is very fast. • Inappropriate if you have a large number of records and the user will not wait to see them all.
Subfile Loading Techniques • File Spec Changes (p. 278) • Code (p. 279)
Subfile Loading Techniques • Variation 1: Subfile size one greater than page • Loads subfile one page at a time based on user’s request for additional pages. • New keywords: • PAGEDOWN, ROLLUP • SFLEND • If off, the system displays a plus sign. • If on, it is not displayed. • SFLRCDNBR
Subfile Loading Techniques • Variation 2: Size much Bigger than Page • Also builds subfile one page at a time. • Doesn’t have to allocate additional space in subfile before loading. • Slight changes to display file: • Subsiz • Pagedown moved to SFLSECT record format. • RPG code remains the same.
Subfile Loading Techniques • Variation 3: Subfile size equals page • Appropriate for scrolling through a large number of records. • Response time is consistant. • Subfile only stores one page of information. • DDS changes are minimal. • RPG changes are great. • Subfile must be cleared before every display. • Load next 15 records or start at the beginning.
ReadC Operation • READC (Read Next Changed Record) • Generally used with a loop, reads only those records from a subfile that were changed during a prior EXFMT operation.