read statement

 The Get Statement


 The Get statement is used read data from a file opened in random mode. The syntax, as it applies to random files is:
 

Get [#]filenumber, [recnumber], varname

 The filenumber is any valid filenumber.
 Recnumber is the record position within the file that is read. The record position is "one-based", meaning the first record position in the file is 1, the second record position is 2, and so on. You can omit this entry, in which case the next record following the last Get or Put statement is read. If you omit the record number entry, you must still include the delimiting commas in the Get statement, for example:
 

Get #intRndEmpFileNbr, , mudtEmpRecord
 Varname is the record variable into which the data will be read. The record variable is a variable defined on the UDT record structure as described above. Once the Get statement is executed, the data from the file record can be referenced using the following syntax: recordname.fieldname
For example, a reference the EmpName field would be coded as:
 mudtEmpRecord.EmpName

 

basic file handling by v. vanthana