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)

$00$ = indexed file
$01$ = serial file
$02$ = keyed file
$03$ = string file
$04$ = BBx program file
$84$ = BBj program file
$05$ = directory file
$06$ = MKEYED file
$07$ = C-ISAM file
$08$ = XKEYED filee
$09$ = FULLTEXT file (BBj 15.0 and higher)
$0B$ = JKEYED file (Deprecated)
$0C$ = encrypted file opened without its required password
$0D$ = VKEYED file

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

$2x$ = 64-bit large file
$4x$ = Highly recoverable file

The following combinations are possible:

$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.

See also FID() Function - Get File Identification.

Examples

>LET A$=XFID(6)
>PRINT A$(14)
/usr/bbx/prog1
>PRINT DEC(A$(10,4))
-1 

See Also

Functions - Alphabetical Listing