FID(channelno{,ERR=lineref})
For BBj-specific information, see FID() Function - Get File Identification.
See also XFID() Function - Get File Identification.
The FID() function returns a string describing the attributes of the file currently OPENed on channelno. If channelno was OPENed with an alias and resulted in opening a PRO/5 device, FID() returns only the alias name and may be a string from one to six characters long.
Channel zero refers to the terminal device. Normally, the value returned by FID (0) is the terminal alias (T0, T1, etc.). However, if PRO/5 is running in background or with redirected standard I/O, the file name associated with channel 0 will be IO, which has no special capabilities other than to read and write data.
If the channel was opened without an alias, then FID() returns a string with the following information:
|
Bytes |
Contents |
Conversion Code |
|
1,1 |
File Type. |
FID$(1,1) |
|
2,1 |
Logical key size, or 0 for multi-keyed MKEYED files. |
ASC(FID$(2,1)) |
|
3,4 |
Number of records, or -1 for byte-oriented files. |
DEC(FID$(3,4)) |
|
7,2 |
Bytes per record or, -1 for byte-oriented files. |
DEC(FID$(7,2)) |
|
9,* |
File name. |
(remainder of the FID)FID$(9) |
The FIN().Function may also be used to provide information about an open file.
>LET A$=FID(6)
>PRINT A$(9)
/usr/bbx/prog1
>PRINT DEC(A$(7,2))
-1