File Navigation

All these commands (except Get RECord) only require one parameter, an indexid. If you specify an indexid, then the order of the records in that index will be used. If you specify a bufferid, then the order of the records in the default index for that buffer will be used. If there is no index for that buffer or the default indexid is zero, then the order of the records in the file will be used. That is the order specified by the recordid. Not specifying an indexid is the same as specifying the default bufferid.


FiRST record

Get the first available record. That is the first record if the given buffer is view only, or if the first record is not locked, else it is the first record which is not locked.

Sbasic
    FIRSTrec #indexid
Assembler
    FRST
    indexid
C
    long DDfirstrec(long indexid);
  
errors, code,   meaning
itnf    -7      invalid index- or bufferid
                no first record found
imem    -3      insufficient memory (only possible with indexes)

LAST record

Get the last available record. That is the last record if the given buffer is view only, or if the last record is not locked, else it is the last record which is not locked.

Sbasic
    LASTrec #indexid
Assembler
    LAST
    indexid
C
    long DDlastrec(long indexid);
  
errors, code,   meaning
itnf    -7      invalid index- or bufferid
                no last record found
imem    -3      insufficient memory (only possible with indexes)

NEXT record

Get the next record in the list which is not locked.

Sbasic
    NEXTrec #indexid
Assembler
    NEXT
    indexid
C
    long DDnextrec(long indexid);
  
errors, code,   meaning
itnf    -7      invalid index- or bufferid
                no next record found
imem    -3      insufficient memory (only possible with indexes)

PREVious record

Get the previous record in the list which is not locked.

Sbasic
    PREVrec #indexid
Assembler
    PREV
    indexid
C
    long DDprevrec(long indexid);
  
errors, code,   meaning
itnf    -7      invalid index- or bufferid
                no previous record found
imem    -3      insufficient memory (only possible with indexes)

Get RECord

Considering that recordid's are the safest way to make links between files, there must be a way to get a record with a specified recordid. And that is exactly what GETrec does. View only files always get the requested record (unless it was deleted or never existed). When the current record is requested, then nothing happens (no error, but the record is not 'truncated' either).

Sbasic
    GETrec #bufferid, recordid
    recordid : long
Assembler
    GREC
    bufferid
    long recordid
C
    long DDgetrec(long bufferid, long recordid);
  
errors, code,   meaning
itnf    -7      invalid bufferid
                or record not found (invalid recordid)
imem    -3      insufficient memory (record too long)
fdiu    -9      record in use by another buffer (read/write buffers only)

FORWard

Get a certain following record. This command allows you to skip some records, that is to move through the file with a relative displacement. When given a displacement of one, this command is the same as NEXTrec.

If the requested record was locked, it will take the NEXT record.

The displacement should always be positive. Any value smaller than one will be treated as if it was one.

Sbasic
    NEXTrec #indexid, displacement
    displacement : short
Assembler
    FORW
    indexid
    short displacement
C
    long DDforward(long indexid, short displament);
  
errors, code,   meaning
itnf    -7      invalid index- or bufferid
                no next record found
imem    -3      insufficient memory (only possible with indexes)

BaCKWard

Get a certain preceding record. This command allows you to skip some records, that is to move through the file with a relative displacement. When given a displacement of one, this command is the same as PREVrec.

If the requested record was locked, it will take the PREVious record.

The displacement should always be positive. Any value smaller than one will be treated as if it was one.

Sbasic
    PREVrec #indexid, displacement
    displacement : short
Assembler
    BCKW
    indexid
    short displacement
C
    long DDbackward(long indexid, short displament);
  
errors, code,   meaning
itnf    -7      invalid index- or bufferid
                no next record found
imem    -3      insufficient memory (only possible with indexes)

PROGS, Professional & Graphical Software
last edited September 9, 1996