LOTUSSCRIPT LANGUAGE
Dim rec1 As personRecord, rec2 As personRecord Dim fileNum As Integer, recNum As Integer Dim fileName As String fileNum% = FreeFile() fileName$ = "data.txt" recNum% = 5
Open fileName$ For Random As fileNum% Len = Len(rec1) rec1.empNumber% = 123 rec1.empName$ = "John Smith" Print Seek(fileNum%) ' Prints 1 for current position Put #fileNum%, recNum%, rec1 ' Write data at record 5 Print Seek(fileNum%) ' Prints 6
Seek fileNum%, 1 ' Rewind to record 1 Print Seek(fileNum%) ' Prints 1 Rec2.empNumber% = 456 Rec2.empName$ = "Jane Doe" Put #fileNum%, , rec2 ' Write at current position Print Seek(fileNum%) ' Prints 2
Close fileNum%
See Also