XFID() Function - Get File Identification

Syntax

XFID(channelno{,ERR=lineref})

Description

The XFID() 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 BBj device, XFID() returns only the alias name.

Channel zero refers to the terminal device. Normally, the value returned by XFID(0) is the terminal alias (T0, T1, etc.). However, if BBj 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 XFID() returns a string with the following information:

Bytes Contents Conversion Code
1,1 File Type XFID$(1,1)
Flag File Type
$00$ indexed
$01$ serial
$02$ keyed
$03$ string
$04$ BBx program
$84$ BBj program
$05$ directory
$06$ MKEYED
$07$ C-ISAM
$08$ XKEYED
$09$ FULLTEXT (In BBj 15.00 and higher)
$0B$

JKEYED

JKEYED files were removed in BBj 25.00.

$0C$ encrypted file opened without its required password
$0d$ VKEYED

The XFID() file type can be modified by flags that define variations of MKEYED and XKEYED files. The flags have the following meanings:

Flag Description
$2x$ 64-bit large file
$4x$ Highly recoverable file

The following combinations are possible:

Flag Description
$06$ 2 GB MKEYED file
$26$ 64-bit MKEYED file
$46$ 2 GB MKEYED file, highly recoverable
$66$ 64-bit MKEYED file, highly recoverable
$08$ 2 GB XKEYED file
$28$ 64-bit XKEYED file
$48$ 2 GB XKEYED file, highly recoverable
$68$ 64-bit XKEYED file, highly recoverable
2,4 Logical key size or 0 for MKEYED, XKEYED, or VKEYED files DEC(XFID$(2,4))
6,4 Number of records or -1 for byte-oriented files DEC(XFID$(6,4))
10,4 Bytes per record or -1 for byte-oriented files. DEC(XFID$(10,4))
14,* File name XFID$(14)

The XFIN() Function may also be used to provide information about an open file.

Examples

>LET FILE$=XFID(6)

>PRINT FILE$(14)

/usr/bbx/prog1

>PRINT DEC(FILE$(10,4))

-1

See Also

FID() Function - Get File Identification

Functions - Alphabetical Listing