Read routine

The read routine is invoked with these parameters:

BRIF calls the read routine as the data records are required to be displayed. Data not being displayed is not retained.

Start of changeAfter the first screen of data is displayed, the first SCROLL DOWN MAX command results in a request to the dialog read routine for relative record number 99999999. When the EXTEND parameter is used relative record 2147483646 is requested. The read routine is responsible for determining the relative record number of the last record in the data. It must return that last record number, and a pointer to the data with a return code of 4; the end of file is temporary, or 8, if the end of file is permanent. When BRIF receives this response, it uses the last record number to determine the relative record number of the first data record that should appear on the display (last record number minus the number of data lines on the display + 1). BRIF then calls the read routine requesting this first data display record, and subsequently requests all following records up to the last record in the data to fill the display.End of change

The read routine should maintain the previous record number requested so that on the next read request a determination can be made whether the requested record is the next record in the data. This could save a considerable amount of processing time in the read routine, since data records are frequently requested in sequential order for partitions of data.

If an I/O error occurs while attempting to read to the end of data, the read routine returns the relative record number of the record causing the I/O error with a return code of 8. When BRIF requests this record number again to format the screen, the read routine then issues a return code of 16, indicating a read error.

The BRIF service requests and displays all additional records beyond the temporary end of data (return code 4) if you attempt to scroll down past the end of data or cause any interrupt (such as Enter) when the end-of-data line is present on the display.

If you decrease the number of records during the BRIF session, the read routine can set a new last record number that is smaller than the current value with return code 4.

When the BRIF service receives a return code 8, it sets the last record number as the permanent end of file. The BRIF service does not request any additional records beyond the permanent end of file.