section{Record Manipulation

Now that we know how we can change the data in a record, we also have to be able to copy them back into the file (implement them), to create new records,...


DELEte record

Delete the current record from the file. The record will remain in the buffer, but the recordid will have changed if you re-implement it! When followed by a NEWrec or GETrec or similar command, the record can't be retrieved.

Sbasic
    DELrec #bufferid
Assembler
    DELE
    bufferid
C
    long DDdelrec(long bufferid);

errors, code,   meaning
itnf    -1      invalid bufferid
rdo     -20     read only buffer
...             any file i/o error (only when disk-based)

DUPLicate record

This command can be used if you need a new record which is similar to the current record. The record in the buffer will be treated as a new one. However the buffer will stay the same. But when you implement, the old record will be the same, and you will have a new record with another recordid and any changes you made to the record.

Sbasic
    DUPLICATE #bufferid
Assembler
    DUPL
    bufferid
C
    long DDduplicate(long bufferid);

errors, code,   meaning
itnf    -7      invalid bufferid

IMPLement record

Implement the given buffer in the file. Necessary if you want the changes you made in a the buffer to appear in the file. The contents of the buffer isn't changed, but the newly created record will get a place in the file and a recordid.

If the file is disk-based, then the record will immediatly be written to disk to ensure complete safety in case of a power failure or a system crash.

If the file is disk-based and a "drive full" error may occur, then the record is not (re-)implemented, and a an error is reported.

Note that other file-errors may cause problems.

Sbasic
    IMPLEMENT #bufferid
Assembler
    IMPL
    bufferid
C
    long DDimplement(long bufferid);

errors, code,   meaning
itnf    -7      invalid bufferid
imem    -3      insufficient memory
drfl    -11     there was risk of a "drive full"
                too many records (impossible, indicates problems)
nimp    -19     not implemented, only occurs when using the demo version
...             any file i/o error (should not occur)

NEW Record

Make sure the record in the buffer is a new one. This means that the current record will be empty (all fields cleared), and without recordid just yet.

Sbasic
    NEWrec #bufferid
Assembler
    NEWR
    bufferid
C
    long DDnewrec(long bufferid);

errors, code,   meaning
itnf    -7      invalid bufferid

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