LOTUSSCRIPT LANGUAGE
Dim rec1 As PersonRecord, rec2 As PersonRecord Dim fileNum As Integer, recNum As Integer Dim fileName As String recNum% = 1 fileNum% = FreeFile() fileName$ = "data.txt"
' Create a record. Open fileName$ For Random As fileNum% rec1.empNumber% = 123 rec1.empName$ = "John Smith" Put #fileNum, recNum%, rec1 Print rec1.empName$ ; rec1.empNumber% ' Output: ' John Smith 123
' Lock and update the record. Lock #fileNum%, recNum% Get #fileNum%, recNum%, rec2 Print rec2.empName$ ; rec2.empNumber% ' Output: ' John Smith 123 rec2.empName$ = "John Doe" Put #fileNum%, recNum%, rec2 Print rec2.empName$ ; rec2.empNumber% ' Output: ' John Doe 123
' Release the lock. Unlock #fileNum%, recNum% Close fileNum%
See Also