Ü  Subfile

·         A subfile is nothing but just displaying records in tabular format on a display device.

·         It can be an editable tabular format due to which it can be used in data entry screen, inquiry(static) screen or combination of both i.e. editing the information for a particular inquiry.

·         The subfile first of all loads the data in subfile buffer. Maximum of 9999 can be loaded in subfile buffer at a time. Trying to load more leads to session or device error.

·         To create a subfile we use SCREEN DSIGN AID tool (Command STRSDA)

·         A subfile has two record format:

1.  Subfile control record format

2.  Subfile record format

·         A subfile’s process can be divided mainly into 3 parts:

1.  Clearing the subfile control record format.

2.  Loading the subfile buffer with the relevant data.

3.  Displaying the data from subfile buffer to the display device.

·         CHAIN, READC, UPDATE, or WRITE operation codes can be used for subfile record format to transfer data between the program and the subfile.

·         READ, WRITE, or EXFMT operation codes cane be used for subfile control-record format to transfer data between the program.

·         EXFMT first of all write the keyboard input to the screen (to the screen field variable) and then read it. Hence by write operation we can have the value in the screen field available.

·         Session or device error comes when there are no records in the database to fill the subfile. For more information on session or device error refer the chapter on Session or device error.

 



Ü  Types of subfile

 

  I.            Load-All  Subfile

·         In Load-All subfile all the records are written to the subfile buffer at once and then the data in the subfile loaded from the buffer.

·         In this case SFLSIZ should be at-least 1 greater than the SFLPAG.

·         If we are writing more records in the subfile buffer than the SFLSIZ declared and SFLSIZ<9999, then the SFLSIZ is extended to accommodate all records till the size of 9999. 9999 is the buffer limit.

·         In this case PAGEUP AND PAGEDOWN is taken care by system. SFLPAG should be less than SFLSIZ.

·         In load-All subfile if we do PAGEDOWN and then press ENTER on the page, by-default ENTER bring the display screen to the very first page irrespective of the current page number. To avoid this situation, we use file information data structure to get the current page RRN number and pass it to the SFLRCDNBR hidden field defined in the display file DDS.

  

 

II.            Single Page/non-elastic

·         In this case sub file size (SFLSIZ) must be equal to subfile page (SFLPAG).

·         Every time the record is written in the buffer, buffer is cleared before writing. After clearing the subfile buffer, records equal to the size of SFLPAG is written. Hence every time we find SFLSIZ=SFLPAG.

·         We call this subfile Non-elastic also which means, the buffer size will be equal to the page size always.

·         In this case, PAGEUP and PAGEDOWN handling is required.

 

 

III.            Expandable/elastic/growing

·         In this case each time the subfile buffer is loaded with SFLPAG size. But unlike single page the buffer is not cleared before writing the new data. Hence as a result the buffer size starts growing.

·         if first time we have loaded 10 records from the Physical file to subfile buffer then second time the size of the buffer will be 10 +10, 3rd time the size of subfile buffer will be 10+10+10…. and so on. Due to the growing nature of this subfile, we also call is growing or elastic subfile.

·         In this case SFLSIZ should be at-least 1 greater than the SFLPAG.

·         If we are writing more records in the subfile buffer than the SFLSIZ declared and SFLSIZ<9999, then the SFLSIZ is extended to accommodate all records till the size of 9999. 9999 is the buffer limit.

·         In this PAGEUP handling is not required as it is taken care by the system itself. Only PAGEDOWN handling is required.

·         In Expandable subfile after PAGE UP if we press ENTER, then the page that is displayed on the screen is that we had at our  last  PAGEDOWN. i.e. suppose we are on page-3 after pressing 2 PAGEDOWN. From page-3 if we press 1 PAGEUP and then press ENTER, the page to be displayed should be the 2nd page, but it is not the case. In this case, the page that is displayed after pressing ENTER is 3rd page which is the page no. that we got after the latest PAGEDOWN activity. To avoid this situation, we use file information data structure to get the current page RRN number and pass it to the SFLRCDNBR hidden field defined in the display file DDS.










User Comments:



Subscribe

  Email:



Copyright © Go4as400.com, 2013-2017. Copyright notice