FID() Function - Get File Identification

Syntax

FID(channelno{,ERR=lineref})

Description

For BBj-specific information, see FID() Function - BBj.

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)

$00$ = indexed file

$01$ = serial file

$02$ = keyed file

$03$ = string file

$04$ = program file

$05$ = directory file

$06$ = multi-keyed file

$07$ = C-ISAM file

The FID() function reports flags indicating variations of Mkeyed files introduced in PRO/5 Rev. 2.0 and above. The flags have the following meanings:

$20$ = 64-bit large file (introduced in PRO/5 Rev. 3.0).

$40$ = Highly recoverable (introduced in PRO/5 Rev. 2.0).

$80$ = 4-GB large file (available in PRO/5 Rev. 2.x only).

The following are examples of files with different flag combinations:

$26$ = 64-bit multi-keyed MKEYED file (PRO/5 Rev. 3.x or higher).

$46$ = 2-GB MKEYED file, highly recoverable.

$66$ = 64-bit MKEYED file, highly recoverable (PRO/5 Rev. 3.x or higher).

$86$ = 4-GB MKEYED file (PRO/5 Rev. 2.x only).

$C6$ = 4-GB MKEYED file Highly Recoverable (PRO/5 Rev. 2.x only).

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.

Examples

>LET A$=FID(6)
>PRINT A$(9)
/usr/bbx/prog1
>PRINT DEC(A$(7,2))
-1

See Also

Functions - Alphabetical Listing