LOTUSSCRIPT LANGUAGE


Example: LOC function
Type PersonRecord
  empNumber As Integer
  empName As String *20
End Type

Dim rec1 As PersonRecord, rec2 As PersonRecord
Dim fileNum As Integer
Dim fileName As String
fileNum% = FreeFile()
fileName$ = "data.txt"

' Create a sample file.
Open fileName$ For Random As fileNum%

' Write at record 1.
rec1.empNumber% = 123
rec1.empName$ = "John Smith"
Put #fileNum%, 1, rec1
Print LOC(fileNum%)       ' Output:  1

' Write at record 2.
rec2.empNumber% = 456
rec2.empName$ = "Jane Doe"
Put #fileNum%, 2, rec2
Print LOC(fileNum%)       ' Output:  2

' Read from record 1.
Get #fileNum%, 1, rec2
Print LOC(fileNum%)       ' Output:  1

Close fileNum%

See Also