FSTAT

Contents


fstat is used to give the return status of a file operation or lock instruction.

 

Class, type and dimension

Text [S]fstat

 

Examples

   # Reading a record
    Read [CLI]CODE = 123
    If fstat = 0 : Infbox "Read OK" : Endif
   # Locking a symbol: warning, the loop is infinite
   # as long as the symbol is locked by another user!
    Repeat Lock ABC Until fstat = 0
   # Sequential read of a file
    Repeat
       Rdseq LIGNE(I)
       I += 1
    Until I >= dim(LIGNE)| fstat <> 0

 

Description and comments

fstat is used to give the result of an operation on an indexed sequential file (read, write or lock), a sequential file (read) or locking of a symbol (Lock). fstat is always set to 0 if the operation has been successfully completed, and a non-null value if there is an error:

·         in sequential read (Getseq, Rdseq), fstat is set to 1 at the end of the file,

·         on Lock, fstat is set to 1 if the lock could not be performed,

·         for an operation on a sequential indexed file (Read, Look, Readlock, For, Write, Delete, Rewrite), the error statuses are from 1 to 5, as shown in the following table:

Value

fstat

Explanation

1

ERLOCK

The record is locked.

2

ERECIND

In read mode <= or >= , indicates that read has taken place, but the key found is < or > the set value.

3

ERDUPCL

Attempt to create a duplicate key;

4

ERDEBF

Attempt to read a key lower or higher than all the keys in the file (start/end of file) or in the selection.

5

ERPALEC

Record not read (means that there is no current record).

 

Associated errors

No associated errors.

 

Associated key words

READ - WRITE - LOOK - FOR - DELETE - REWRITE - READLOCK - LOCK - RDSEQ - WRSEQ - GETSEQ - PUTSEQ


CONTENTS


Copyright © Sage 1999 - 2007