Reading Record: – The random-access file read one full record at a time. The get statement is used to input a record from a random-access file. Syntax of the get statement is –

                Get <File Number> [,Record Number] <,Variable Name>

Where file number, record number and variable name have the same meaning as in the put statement. If record number is omitted, then the record read will be either the one following the most recent put  or get operation, or the record number written by the most recent seek operation. If record number is specified, get statement input one record from specified position. For example: –

                Get 1, 10, MyRec

The above statement read a record from 10th record position. Another example –

                Get 1, , MyRec

The above example read one record just after recent record position.

Advertisements