LOTUSSCRIPT LANGUAGE


Examples: Get statement
Type PersonRecord
  empNumber As Integer
  empName As String * 20
End Type

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

' Open a random file with record length equal to the
' size of the records in rec.
Open fileName$ For Random As fileNum% Len = Len(rec)

' Write a record at position 1.
rec.empNumber% = 123
rec.empName$ = "John Smith"
Put #fileNum%, 1, rec

' Write a record at position 2.
rec.empNumber% = 456
rec.empName$ = "Jane Doe"
Put #fileNum%, 2, rec

' Write a record at position 3.
rec.empNumber% = 789
rec.empName$ = "Jack Jones"
Put #fileNum%, , rec
' Rewind to the beginning of the file and print all records.
Seek fileNum%, 1
Do While Not EOF(fileNum%)
  Get #fileNum%, , rec
  Print rec.empNumber%; rec.empName$
  ' Get function automatically advances to the next record.
Loop
Close fileNum%

' Prints three records:
'  123 John Smith          
'  456 Jane Doe            
'  789 Jack Jones  

See Also