System Functions
FIB( ) Return File Information Block
   
Format FIB(chan[,ERR=stmtref])
 
Where:
chan Channel/logical file number of the file about which you want information.
stmtref Program line number or statement label to which to transfer control.
   
Returns String, file information block description.
   
Description The FIB( ) function returns a character string containing a file information block description for an existing open file. This information may be passed to a FILE directive to subsequently recreate the file. Refer to the File Information Functions Overview and the ProvideX Standard Format for FIB(0) and FID(0) for further details. Unlike FID( ) , the FIB( ) function is not affected by emulation mode settings.


*Note* When 'FF' is set to 0 or 3 and the 'PO' system parameter is switched on, the FID( ) and FIB( ) functions return the original path used when the file was opened. 'FF'.


Examples 0010 INPUT "Enter filename:",F$
0020 OPEN (1)F$
0030 IF MID(FIB(1),10,1) <> $02$ THEN PRINT "Not a Keyed file"
   
See Also FID( ) Return File Information Descriptor,
FIN( ) Return File Information,
FILE Directive
'FF' File format
'PO' Path Original
   
File Information Functions Overview The FIB( ), FID( ) and FIN( ) functions return file information, descriptors and blocks. FID( ) returns file characteristics or descriptors such as the type of file, size, keys (if applicable) and the absolute location (pathname) of the file on the disk system. FIB( ) always returns the information in ProvideX Standard Format (described in the following section).

ProvideX returns file identifiers for a file through either the FID( ) or FIB( ) function. Normally these two functions will both provide the same information, but to simplify conversion to ProvideX from various Business Basics, ProvideX returns one of 5 different formats for the FID( ) function, based on the setting of the 'FF' system parameter.

There is one exception to the above. For a device, the FID( ) function always returns only the device name. For example, FID(0) will yield the terminal identifier.

You can define the value returned by FID(0) externally using the Environment variable PVXFID0 or internally using the SETFID directive. FIN( ) returns file information about the data structure (describing the physical aspects of a file such as maximum record, number of records, key size, record size).

   
FIB/FID Layouts ProvideX Standard Format for FIB(0) and FID(0)

The following charts describe the FID(0)/FIB(0) ProvideX standard format for 'FF'=0.

C
O
M
M
O
N
Bytes Description of common info.
1,3 Current record count (if available)
4,6 Characters 1-6 of filename (will include the path, if used)
10,1 $00$ - Indexed
$01$ - Serial, PDF, Database
$02$ - Keyed
$03$ - Open via ISZ= (binary)
$04$ - Program
$05$ - Attached printer
$07$ - Isam
$08$ - (Not used)
$0A$ - Pipe
$0D$ - Directory
$0E$ - TCP/IP
$0F$ - Device or Windows printer
11,1 External key size
12,3 Maximum number of records
15,2 Record size
17,1 Keyed file flag ($01$if variable length records)
18,1 Keyed file inventory threshold %
19,1 File type:
"*" Device ">" I/O redirection
"2" EFF file type indicator "A" Attached printer
"B" Opened via ISZ= "C" C-ISAM
"d" BBx Directory "D" Directory
"E" DDE Connection "F" PDF File
"I" Indexed "K" Keyed/Direct/Sort
"l" DLL file "m" BBx M-Keyed File
"M" Dynamic *MEMORY* File "N" TCP/IP Connection
"o" OCI Data file "O" ODBC Data file
"p" Program Library PSUEDO File (internal use only)
"P" Program "Q" MySql
"S" Serial "T" WindX Connected Device/File
"V" Variable Data File "W" Windows Printer
20,1 External file handle
21,1 Current attribute byte
22,1 Current foreground colour
23,1 Current background colour
24,1 Reserved for future use
25,60 External file pathname
K
E
Y
E
D

F
I
L
E
S
Bytes Description For Keyed files
85,384 A series of 4 or 8-byte extended entries (for extended key attributes). The maximum number of key segments can range between 48 and 96 depending on the number of 4 and 8 byte entries found.

The first of each group of 4 bytes indicates the key number or contains $FE$ is the 4 bytes are an extension of the key descriptor.

(1,1) The four lower bits contain the key number

KEYNUM=DEC(AND(KDAT$(1,1),$0F$))

The four high order bits contain offset information used in conjunction with byte (3,1).
A value of $FF$ indicates final entry.

A value of $FE$ indicates that this key entry is an extension of the prior key entry.

Note: When working with an EFF file, the key number will be reset to zero after the 16th key. For example on a file with 35 keys, the key number in byte (1,1) will go from 0 to 15 then for key 17 byte (1,1) will be zero again. It will climb to 15 then for the 33rd key byte (1,1) will be zero again. Byte (1,1) for the 35th key will be 2.
(2,1) Field # in record ($FF$=KEY)
(3,1) Offset in field (in conjunction high order four bits of byte (1,1)), maximum 3839.

KEYOFFSET=16*DEC($00$ + AND($F0$,KDAT$(1,1))) + DEC($00$+KDAT$(3,1))

(4,1) Length of key (descending if bit $80$ is on)
Extended entry:
(5,1) $FE$ indicates extended entry, otherwise it is byte (1,1) of next entry.
(6,2) Segment attributes (cumulative):

$0001$ Unique key
$0002$ Convert segment to upper case
$0004$ Convert segment to lower case
$0008$ Convert using translate table
$0010$ Swap byte order
$0020$ Primary key allows duplicates
$0040$ Don't add key if the segment is null
$0100$ Don't add key if all segments are null
$0200$ Binary auto-increment key
$0400$ Ignore data after $00$
$0800$ Zero-filled auto-increment
$1000$ Space-filled auto-increment

(8,1) Null character for NULL keys ((6,2)=$0040$ or$0100$)
T
E
R
M
I
N
A
L
S
Bytes Description for Terminals
85,1 Current column
86,1 Current line
87,1 Maximum column
88,1 Maximum line
89,110 Window information (10 *11 byte entries for top 10 windows):
(1,1) Window number
(2,2) Absolute column (2 Byte)
(4,2) Absolute line (2 Bytes)
(6,1) Number of columns wide
(7,1) Number of lines wide
(8,1) Column 0 of scroll region
(9,1) Line 0 of scroll region
(10,1) # columns for scroll region
(11,1) # lines for scroll region
213,12 Actual device type