as400 interview questions and answers-Part 14


1. What is SFLNXTCHG in display file? Give example of SFLNXTCHG.

Ans:

SFLNXTCHG

 

·         This keyword is very useful in case of editable subfile.

·         If before processing the subfile records, we are validating those records, then first of all we will use REACDC to find the records that is to be validated and then again by using READC we will process the same records.

·         But READC works the first time but not the second time on the same record.

·         The reason behind is, the first READC operation issued on the record, sets the MDT(modified data tag) off, resulting into the situation in which that record won’t be read again by 2nd READC operation.

·         READC identifies the records that have been changed by the processing option.2nd time since the MDT flag for those records will be off, the records won’t be treated as the changed records.

·         Now if we want that the second time also the record should be read, so that it can be processed, we need to use SFLNXTCHG keyword.

·         One more thing to note about is that the record of a subfile is treated to be changed if it is field exited or it is keyed into or some wrong processing option is taken or some wrong entry/update is made to the record.

For example of SFLNXTCHG please refer: Click here...

 

2. What is subfile in AS400? What are the types of subfile? Explain with example.

Ans:

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.

   For example of LOAD ALL subfile, please refer: Click here...

 

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.

For example of SINGLE PAGE subfile, please refer: Click here...

 

 

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.

   For example of Expandable subfile, please refer Click here...

 

 

 

 

 

3. What is session or device error in AS400? Give example of session or device error.

Ans:

Ü Session or device error

 

     Below are the situations which can lead to session or device error:

 

·         Incorrect record number in subfile SFLRCDNBR or SFLSIZ field.

·         In program code, at display (EXFMT) subfile code,  check the value of RRN. If is zero and you are making on the SFLDSP indicator *ON or it is un-conditional and doing display subfile. Then it will give you the same error.         

·         Trying to show empty subfile.

·         Field and position in Display file DDS is not correct.

·         The keywords are not properly organized in Display file DDS.

·         Trying to write more than 9999 record on the Display file for Load All subfile i.e.

For example of session or device error, please refer Click here...

 




 

 







User Comments:



Subscribe

.  


Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy