Record Command

Purpose

Specifies the next record to be read with Get # or written with Put #.

Syntax

Record[%] #n, record

Record[%](#n)

n:integer expression; channel number
record:integer expression

Description

The command Record #n, record specifies the next record to be read with Get # or written with Put #.

Record% can be used for file sizes less then 2GB.

The function Record() returns the current record or byte number.

Example

Global age%, firstname$, ct|(5), i%, n1$, n2$, nr|, secondname$

OpenW # 1

Open App.Path & "\Musicians.DAT" for Random As # 1, Len = 52

Field # 1, 24 As firstname$, 24 As secondname$, 4 At(V:age%)

//

For i% = 1 To 5

Read n1$, n2$, age%

Lset firstname$ = n1$

Lset secondname$ = n2$

Put # 1, i%

ct|(i%) = i%

Next i%

Close # 1

Data Harold,Faltemeyer,56,Robin,Williams,32,Barry,Manilow,78,Bryan,Adams,52,Demi,Lovato,21

//

Open App.Path & "\Musicians.DAT" for Random As # 1, Len = 52

Field # 1, 24 As firstname$, 24 As secondname$, 4 At(V:age%)

For i% = 5 DownTo 1

nr| = Rand(i%) + 1

Record # 1, ct|(nr|)

Get # 1

Print "Record" & ct|(nr|) & ": " & Trim(firstname$) & " " & Trim(secondname$) & " aged" & age%

Delete ct|(nr)

Next i%

Close # 1

Kill App.Path & "\Musicians.DAT"  // Tidy-up line

Remarks

The function Record() is the reverse function to the command Record.

Record(# i) = Loc(# i) \ FileAttr(# i, 6) + FileAttr(# i, 4)

See Also

Field, Get#, Put#, Seek, FileAttr

{Created by Sjouke Hamstra; Last updated: 22/10/2014 by James Gaite}