FSTAT |
fstat is used to give the return status of a file operation or lock instruction.
Text [S]fstat
# Reading a recordRead [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 fileRepeat
Rdseq LIGNE(I) I += 1Until I >= dim(LIGNE)| fstat <> 0
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). |
No associated errors.
READ - WRITE - LOOK - FOR - DELETE - REWRITE - READLOCK - LOCK - RDSEQ - WRSEQ - GETSEQ - PUTSEQ
CONTENTS
|
|