Handling C-ISAM Files | Byte-stream File Handling |
Btrieve is the file handling system from Pervasive Software, Inc. For full details on Btrieve, consult the Btrieve documentation supplied by Pervasive Software.
This COBOL system provides call conversion modules which enable you to:
The call conversion modules are:
Xfh2btr | For Extfh to Btrieve call conversions. Xfh2btr takes Extfh format I/O operations and converts them to the equivalent Btrieve I/O calls. |
Btr2xfh | For Btrieve to Extfh call conversions. Btr2xfh takes Btrieve format I/O operations and converts them to the equivalent Extfh format calls. |
The following sections describe each call conversion module, how to invoke it, compatibility between Extfh and Btrieve I/O operations and, for Xfh2btr only, the environment variables which affect its behavior.
The Xfh2btr call converter, for Extfh to Btrieve call conversions, takes Extfh format I/O operations and converts them to Btrieve I/O calls. This enables you to handle Btrieve files from your COBOL programs.
The Xfh2btr call converter is compatible with versions of Btrieve 5.1x and above on the following environments:
Notes:
Xfh2btr is supplied as part of this COBOL system and also as a linkable module, xfh2btr.obj, which can be linked with any application that needs to perform I/O on Btrieve files.
When the converter needs to call the Btrieve run-time to perform I/O, it calls the module _BTRV. The function of this module is to format the call and pass it to the Btrieve Record Manager. For example, the Btrieve Dynamic Link Library btrcalls.dll is called if the COBOL application is running on OS/2.
Notes:
When linking any application to a stand-alone executable file, you need to link in obtrv.obj for OS/2, dbtrv.obj for DOS and wbtrv.obj for Windows. Each of these modules has an entry point of _BTRV.
Alternatively, if you have the Btrieve Developer's Kit, you can link the modules supplied by Pervasive Software in place of _btrv.obj. These are cobrbtrv.obj and cobpbtrv.obj . For more details of these modules, see the documentation supplied with the Btrieve Developer's Kit.
There are three ways to call the Xfh2btr call converter:
Each of these methods is explained in the following sections.
The CALLFH Compiler directive specifies the file handler used by your program for all COBOL I/O operations. If no file handler is specified, the default file handler, Extfh, is used.
To enable your program to pass all I/O to the Xfh2btr call converter so that COBOL I/O operations are converted to Btrieve I/O operations, you include CALLFH at the top of your source program as an initial $SET statement as follows:
$set callfh"xfh2btr"
All I/O performed by the program now passes to Xfh2btr.
Note that some file operations and formats are not supported by Btrieve; for example, WRITE AFTER and line sequential files. Attempting to direct file I/O to the converter in these situations causes an error to be returned.
You can use this directive in combination with the FILETYPE directive. See the description of the FILETYPE directive below.
The FILETYPE Compiler directive specifies the file format of files created by your program.
You can put the FILETYPE Compiler directive at the top of your program as an initial $SET statement as follows:
$set filetype"n"
where n
, in this case, can be either 5 or 6.
FILETYPE"5" is used when it is important for file operations to conform to ANSI standards. Btrieve does not normally conform to ANSI standards and this mode of operation requires a number of calls to the Btrieve run-time so that it emulates ANSI behavior.
FILETYPE"6" is used when speed is important. In this mode of operation, each Extfh I/O operation is mapped to the nearest Btrieve run-time call. No attempt is made to conform to ANSI standards.
The differences between the two modes of operation are explained in the section File Operations without ANSI COBOL Conformance later in this chapter.
If you require sequential and relative files to be processed as Btrieve files, you must use the FILETYPE directive in conjunction with the CALLFH directive.
All I/O is initially passed to Extfh when used in conjunction with the CALLFH Compiler directive. Extfh then ensures that the file operation is supported by Btrieve before passing it to Xfh2btr.
You can mix different types of file within your program by putting the FILETYPE Compiler directive around individual SELECT statements, for example:
$set callfh $set filetype"0" select testfile-1 assign to "test-1.dat" organization indexed record key prime-key access sequential. $set filetype"5" select testfile-2 assign to "test-2.dat" organization relative access sequential.
This causes I/O on testfile-1
to be handled by Extfh and
I/O on testfile-2
to be handled by Xfh2btr.
Using external filename mapping to call Xfh2btr enables you to direct file I/O for a particular file to the converter without the need to recompile your program with the CALLFH and/or FILETYPE Compiler directives. This method assumes that all I/O is currently being handled by Extfh.
On opening a file, Extfh automatically searches the run-time environment space to see if an environment variable of the same name as the file exists. If it does, the filename is mapped to the new name (if one is given) and the new format (if one is given). For example, in your program you may have the following SELECT statement:
$set callfh select testfile-1 assign to "test-1.dat" organization indexed record key prime-key access sequential.
If you enter the following command before running your program:
set test-1.dat=test-1.dat[BtrieveA]
an environment variable with the same name as the file is found and the
file is mapped to a file of the same name, but in Btrieve format. The
[BtrieveA]
parameter following the name defines the file as
Btrieve format with ANSI emulation. Specify [BtrieveN]
for
non-ANSI emulation.
External filename mapping requires the Xfhname module which you must link to any application that uses external filename mapping.
For further details of filename mapping, see the chapter File Naming.
There are two environment variables that you can set in order to change the way in which the Xfh2btr call converter operates: BTRPAGE and BTRMAXREC. These are described in the following sections and refer to both ANSI and non-ANSI modes of operation.
It is possible to specify the value of BTRPAGE and BTRMAXREC on a per-file basis using the xfh2btr configuration file. This provides more flexibility in defining page sizes and record lengths. See the section Xfh2btr Configuration File for more details.
The BTRPAGE environment variable specifies the page size that is used when Btrieve files are created. You can set it using the following command:
set BTRPAGE=nnn
where nnn
is a byte value in the range 512 to 4096
inclusive, in multiples of 512 bytes.
If you do not set BTRPAGE, or you specify an incorrect value, the page size defaults to 1024 bytes.
Notes:
The BTRMAXREC environment variable determines the maximum record size returned on a direct opcode 06 call to the converter. The opcode 06 call is used by file utilities to determine details about the files being used.
You can set BTRMAXREC using the following command:
set BTRMAXREC=nnnn
where nnnn
is a byte value specifying the maximum
record length.
You should set BTRMAXREC to the record size of the largest record to be accessed.
If you do not set BTRMAXREC, the default value of 32 Kilobytes is used.
The majority of COBOL file operations performed by Extfh operate in exactly the same way when performed by Xfh2btr on Btrieve files. However, due to underlying differences between the two systems, there are instances where behavior differs.
You should especially note the positioning of the current record pointer (CRP) when performing sequential read operations after having written, rewritten or deleted records in the same file.
The areas in which Btrieve differs from Extfh are:
Keys
Locked record detection
OPEN OUTPUT
Record lengths
Record reading position
Transaction processing
Write-locks
Each of these areas is described in the following sections.
Using Btrieve v5.x or earlier, the total number of key components (a normal key has one component, a split key has more than one) cannot exceed 24. So, you can have one key of 24 components, 24 keys of one component or any combination of these.
Using Btrieve v6.x or later, the maximum number of key components is 119, and varies depending on the page size of the file.
The Xfh2btr module does not verify the number of key components in the file; if your version of Btrieve does not support the required number of key components then any error returned from the Btrieve run-time system is reported to the application program.
The total length of any key in a Btrieve file cannot be greater than 255 bytes. The total length of a key is the sum of the lengths of all the components making up the key.
All keys in a Btrieve file must be completely contained within the fixed part of any variable length file. See the section Record Lengths later in this chapter for further information.
When this COBOL system reads a record that is locked by another user, the record data is returned to the program together with a file status of "record-locked". The current reading position in the file is unaffected.
With Btrieve, if a record is locked, the data is not returned. Reading a record requires multiple calls to the Btrieve run-time, making the default record reading slower than if the non-ANSI conforming mode is used.
You can improve the speed of the read operations by:
When you do this, calls to the Btrieve run-time to detect record locks are not required. This is because the file is locked exclusively and so records do not need to be individually checked.
Using this directive removes the need to call Btrieve to see if the record is locked by another user.
Note that the non-ANSI conforming mode of operation includes the use of NODETECTLOCK.
When you access a Btrieve file from within a transaction, a temporary exclusive lock is obtained on the file and so calls to the Btrieve run-time to detect record locks are not required. When using Btrieve v6.x or later, concurrent transactions are used.
The COBOL OPEN OUTPUT operation creates a file and opens it with an exclusive lock. This is performed in a single operating system call. With Btrieve, this operation requires two calls to the Btrieve run-time. The first to create the file and the second to open the file with an exclusive lock. This means that a small time lapse exists between these two calls. It is therefore possible for a second user to access the file between the time the file is created and the time that it is opened. If this happens, the second user finds the file empty and an attempt to read the file results in an "at end" error. The user performing the OPEN OUTPUT receives a "file locked" error because the exclusive OPEN call fails.
Variable length record Btrieve files consist of two parts - a fixed length part and a variable length part. Fixed length record Btrieve files consist of only the fixed length part.
Generally, the minimum record length defined in the COBOL program determines the length of the fixed part of the record. However, Btrieve imposes restrictions upon the maximum length of the fixed part of the record. This depends upon the number of keys which allow duplicates and the page size used for the file. See the section Specifying the Btrieve Page Size - BTRPAGE Environment Variable earlier in this chapter for details of page size.
The formula for determining the maximum size that the fixed part of the record can be is given below:-
P - 6 - ( 8 * K ) [- 4 for variable length records] [- 4 for relative files]
where:
P is the page size of the file
K is the number of keys that allow duplicates
If you try to create a fixed length record Btrieve file with a record length greater than the maximum size allowed for the fixed part, then the file is created as a variable length Btrieve file. The size of the fixed part of the record used in the file definition is determined using the above formula.
If you attempt to create a variable length record Btrieve file with a minimum record length greater than the maximum size allowed for the fixed part, then the file is created with the fixed part set to the maximum size allowed.
Notes:
Examples
The following examples use a page size of 1024 bytes:
All the keys must be in the first 1018 bytes of the record.
All the keys must be in the first 1014 bytes of the record.
All of the keys must be in the first 1010 bytes of the record.
All of the keys must be in the first 1006 bytes of the record.
The additional four bytes is due to the auto-increment key that is added automatically to the front of each record.
If you are using the opcode 06 action-code for the Callable File Handler call interface, the record length returned is 1014 bytes.
This length includes the additional four bytes automatically added to the front of each record, due to the auto-increment key.
If you are using the opcode 06 action-code for the Callable File Handler call interface, the record length returned is 1010 bytes.
All of the keys must be in the first 1014 bytes of the record.
All of the keys must be in the first 1014 bytes of the record.
All of the keys must be in the first 1006 bytes of the record.
All of the keys must be in the first 1006 bytes of the record.
The additional four bytes is due to the auto-increment key that is added automatically to the front of each record.
If you are using the opcode 06 action-code for the Callable File Handler call interface, the record length returned is 1010 bytes.
The additional four bytes is due to the auto-increment key that is added automatically to the front of each record.
If you are using the opcode 06 action-code for the Callable File Handler call interface, the record length returned is 1010 bytes.
The file position indicator indicates the position in the file from which sequential READ operations are performed. So, for example, if the file position indicator is on the third record and a READ NEXT operation is performed, this system returns record number 4. Record number 4 is now defined by the Current Record Pointer (CRP).
With this COBOL system, the CRP is only affected when START, READ (sequential or random) and OPEN operations are performed on the file.
With the Btrieve run-time, the CRP is affected when WRITE, REWRITE and DELETE operations are performed on the file. This means that the CRP in a Btrieve file has to be restored to its original position so that sequential READ statements are not affected.
In a shared environment, the re-positioning of the CRP can fail if the record to be re-positioned on has been deleted by another user. In which case, any attempt to perform a sequential READ returns an error.
In the following sections, re-positioning of the CRP is performed after the operation has completed and not at the time of the next sequential READ statement. This reduces the possibility of the record being deleted and increases the possibility of successfully re-positioning the CRP.
Note: The non-ANSI conforming mode of operation makes no attempt to re-position the CRP and can, therefore, be significantly faster.
For shared files opened I/O that are not in transactions where the ANSI conforming mode of operation is being used, the file is actually opened twice. The first open of the file is used to read records from the file. The second open of the file is used to write records to the file. Therefore, it is not possible for the reading position to be affected by normal WRITE operations. However, if you use the WRITELOCK directive, the inserted record has to be read back with a lock and this changes the CRP in the file.
Re-positioning the Btrieve file position indicator after a WRITE operation can only fail if WRITELOCK directives are used and the file is shareable. If the re-positioning after the WRITE operation fails, an error is returned when the sequential READ is attempted.
For files opened I/O with random or dynamic access, the Btrieve file position indicator has to be moved to the position of the record to be deleted. After performing the DELETE operation, the file position indicator is restored to its original position, although this could fail if the record to re-position on has been deleted.
This problem does not occur for files with sequential access because the file position indicator is already on the record to be deleted and so re-positioning is not necessary.
Note: It is not possible to perform a sequence of sequential READ and DELETE statements when the key of reference is on a key which allows duplicates. This is because it is not possible to re-position the CRP after the DELETE operation.
For files opened I/O with random or dynamic access, the Btrieve file position indicator is moved to the position of the record to be changed. After performing the REWRITE operation, the file position indicator is restored to its original position, although this could fail if the record to re-position has been deleted.
This problem does not occur for files with sequential access because the file position indicator is already on the record to be rewritten and so re-positioning is not necessary.
In this COBOL system, transaction processing is only available if you have installed Fileshare Version 2. However, Btrieve users do not require Fileshare Version 2 in order to implement transaction processing.
When you update records in a file within a transaction with Fileshare, the individual records in the file are locked to prevent another user from reading the record. This is because there is the possibility of a ROLLBACK operation being performed when a record has been removed from the file. However, when you access a Btrieve file via Xfh2btr from within a transaction, the whole file is given a temporary exclusive file lock which prevents other users from accessing the file at the same time. In Btrieve v6.x and later, concurrent transactions are used, so files can be shared in a transaction.
A Btrieve transaction starts whenever a REWRITE, WRITE or DELETE operation is performed for a file that has no transaction in progress and has been opened with ROLLBACK. (Prior to COBOL V3.2 the READ, START or STEP operations also started a transaction.) At this point, Btrieve obtains an exclusive lock on the file and this file lock remains until the transaction finishes, except when concurrent transactions are in use (Btrieve v6.x and later).
Note: For Btrieve v6.x or above, concurrent Btrieve transactions are used. Btrieve then performs locking at the page level. (See the Btrieve documentation for details.)
A transaction finishes when a COMMIT or ROLLBACK operation is performed. The transaction restarts when I/O is performed again on a file which is opened with ROLLBACK.
The CLOSE operation does not re-start transactions because Btrieve CLOSE operations can only be performed when transactions are not active.
File-locked errors are returned by the converter at the time files are opened, as this is the only time that this COBOL system returns a file-locked error. Btrieve can return a file-locked error on accessing a file within a transaction, although this is converted to a record-locked error by the converter which is a status that could legitimately be returned by this COBOL system when accessing files with transactions.
With this COBOL system you can use the WRITELOCK directive to write records in a file and obtain a lock on the record written. Locks are also obtained on records that are re-written to the file.
With Btrieve the record is first written or re-written to the file and then read back to obtain a lock on the record. This requires a number of calls to the Btrieve run-time with small time lapses between the calls. It is possible, therefore, for a second user to access the record and obtain a lock on the written record before it can be read back with a lock by the first user.
Note: Using write-locks does not guarantee that the reading position in the file is kept. See the section Locked Record Detection.
The following file operations differ when you choose non-ANSI conformance mode (use the FILETYPE"6" Compiler directive):
COBOL I/O Call |
Btrieve Run-time Call |
---|---|
OPEN | Open |
CLOSE | Close |
WRITE | Insert |
READ | Get |
START | Get |
DELETE | Get/Delete |
REWRITE | Get/Update |
UNLOCK | Unlock |
ROLLBACK | Abort transaction |
COMMIT | End transaction |
Note: If you want to use the Xfh2btr configuration file, you must link your program with mfini.obj.
Using the Xfh2btr configuration file, it is possible to define the following file attributes on a per-file basis:
It is also possible to turn on a trace option which displays Btrieve error codes when they are returned and also the COBOL status that is returned to the application program.
The format of the configuration file is the standard Micro Focus configuration file format. The name of the configuration file is specified by the XFH2BTR environment variable. If this environment variable is not set then the default configuration filename of xfh2btr.cfg is used. This is searched for first in the current directory and then along the path specified by the COBDIR environment variable.
When using a configuration file the settings of the environment variables BTRPAGE and BTRMAXREC are ignored.
The tag "[X2B-DEFAULTS]" is used to specify the default page size and maximum record lengths and also the default open modes to use when opening a file.
A tag containing a filename (for example "[test1.dat]") can be used to specify the page size and maximum record length and also the open modes to use when processing a particular file.
The attributes that can be specified after each tag section are outlined below. The attribute-name can be separated from the attribute value by a space or colon (:) character.
This specifies the page size that should be used when the file is created. See the section BTRPAGE Environment Variable for details of valid values for this attribute. If a configuration file is used, the settings of the environment variable BTRPAGE are ignored.
This specifies the maximum record length that should be returned on an opcode 06 call to this file. See the section BTRMAXREC Environment Variable for valid values for this attribute. If a configuration file is used, the settings of the environment variable BTRMAXREC are ignored.
INPUT-EXCLUSIVE: open-mode INPUT-SHAREABLE: open-mode OUTPUT: open-mode EXTEND-SHAREABLE: open-mode EXTEND-EXCLUSIVE: open-mode I-O-SHAREABLE: open-mode I-O-EXCLUSIVE: open-mode
These attributes can be used to change the Btrieve open mode that Xfh2btr uses when it opens the file. The possible values of open-mode are as follows:
normal accelerated read-only verify exclusive
Some of these open modes implicitly open the file exclusively on some versions of Btrieve. For example, with the single-user version of Btrieve, accessing a file in accelerated access implicitly makes the file exclusive to that user.
For details of these open modes, consult your Btrieve documentation.
If you do not specify open modes in a configuration file, the default open modes used by Xfh2btr are as follows:
Btrieve Version | Open Mode | |
---|---|---|
Exclusive | OS/2 | accelerated |
Windows | exclusive | |
Network | exclusive | |
Single-user | accelerated | |
Shareable | OS/2 | normal |
Windows | normal | |
Network | normal | |
Single-user | accelerated |
Example
The following is an example of a configuration file:
[X2B-DEFAULTS] output:accelerated i-o-shareable:accelerated i-o-exclusive:accelerated btrpage:2048 btrmaxrec:2000 [test1.dat] output:exclusive i-o-shareable:normal btrpage:4096
The above configuration file specifies the following:
Using a configuration file, it is possible to use a trace option to display the operations that the Xfh2btr module is performing and also the error codes returned from the Btrieve Record Manager. This option is especially useful when investigating problems with the configuration of the Btrieve Record Manager.
If a Btrieve error is not shown on the trace but a COBOL error is returned, this error is generated within the Xfh2btr module. For example, attempting to write to a file open for input would generate such an error. Even though a number of Btrieve API calls might be made to process one COBOL I/O statement only one Btrieve error status is displayed.
There are two attributes that effect the trace option: TRACE-FILE and TRACE. These are described below:
This specifies that the trace information is to be directed to a file and not to the screen. The name of the trace-file can be specified as an attribute value. If no trace-file is specified then the default trace filename of xfh2btr.lst is used. The trace-file attribute can only be specified under the [X2B-DEFAULTS] tag. When a number of client applications are writing trace information to the same trace-file, the order in which the information appears in the file is undetermined.
Note: This does not turn on the TRACE facility.
This specifies that operations to this file are to be traced. The default is for the trace information to be displayed on the screen. This information can be directed to a file using the TRACE-FILE attribute described above. The trace attribute can be specified under the [X2B-DEFAULTS] tag (in which operations to all files are displayed) or under a filename tag (in which operations to only a select few files are displayed).
Examples
The following are examples of configuration files:
[X2B-DEFAULTS] trace-file:x2btrace.dat trace:
This configuration file specifies that the trace option is to be used for every file that is accessed and the trace is to be written to the file x2btrace.dat.
[X2B-DEFAULTS] trace-file: [test1.dat] trace:
This configuration file specifies that the trace option is to be used for all accesses to the file test1.dat and the trace is to be written to the file xfh2btr.lst (the default trace filename).
[test1.dat] trace:
This configuration file specifies that the trace option is to be used for all accesses to the file test1.dat with the trace written to the screen.
[X2B-DEFAULTS] trace:
This configuration file specifies that the trace option is to be used for every file that is accessed with the trace written to the screen.
[X2B-DEFAULTS] open-output:exclusive trace-file:trace.lst [test1.dat] btrpage:1024 [test2.dat] open-output:accelerated btrpage:4096 trace:
This configuration file specifies that, by default, files opened output are opened in exclusive mode. The trace-file trace.lst is used for all trace information. For the file test1.dat the page size to use when the file is created is 1024 bytes. When the file test2.dat is opened output, accelerated open mode is used. The page size to use when test2.dat is created is 4096 bytes, and all access to the file is traced.
The following is an example of the trace output produced when the trace option is used:
|
Line |
---|---|
Input FA01 ifile1.tmp |
1 |
Output Btrieve Error=+0000 COBOL Error=0/0 |
2 |
Input FAF3 ifile1.tmp |
3 |
Output Btrieve Error=+0000 COBOL Error=0/0 |
4 |
Input FAF3 ifile1.tmp |
5 |
Output Btrieve Error=+0000 COBOL Error=0/0 |
6 |
Input FADC All Files |
7 |
Output Btrieve Error=+0000 COBOL Error=0/0 |
8 |
Input FA80 ifile1.tmp |
9 |
Output Btrieve Error=+0000 COBOL Error=0/0 |
10 |
Input FA02 ifile1.tmp |
11 |
Output Btrieve Error=+0000 COBOL Error=0/0 |
12 |
Input FAF5 ifile1.tmp |
13 |
Output Btrieve Error=+0000 COBOL Error=0/0 |
14 |
Input FAF5 ifile1.tmp |
15 |
Output Btrieve Error=+0000 COBOL Error=0/0 |
16 |
Input FAF5 ifile1.tmp |
17 |
Output Btrieve Error=+0009 COBOL Error=1/0 |
18 |
Input FA80 ifile1.tmp |
19 |
Output Btrieve Error=+0000 COBOL Error=0/0 |
20 |
Input FA01 test.dat |
21 |
Output Btrieve Error=+0029 COBOL Error=9/078 |
22 |
Input FA00 ifile1.tmp |
23 |
Output Btrieve Error=+0000 COBOL Error=0/0 |
24 |
Input FAF3 ifile1.tmp |
25 |
Output Btrieve Error=+0000 COBOL Error=4/8 |
26 |
Input FA80 ifile1.tmp |
27 |
Output Btrieve Error=+0000 COBOL Error=0/0 |
28 |
Line 1 shows an example input line: the operation code and the name of the file on which the operation is being performed. For details on operation codes see the chapter The Callable File Handler.
Line 2 shows an example output line: the Btrieve error status and the error being returned to the COBOL application.
Line 7 shows an example of an operation (in this case, COMMIT) being performed on all open files.
Line 22 shows the error status 29 being returned from the Btrieve run-time system and that this is returned to the COBOL application as a 9/078 status. For details of the Btrieve error status 29, see the relevant Btrieve documentation.
Line 26 shows an error that is generated within the Xfh2btr module. An attempt is being made to write to a file which is opened for INPUT.
The Btr2xfh call converter takes Btrieve I/O calls and converts them to Extfh I/O operations enabling you to handle COBOL format files from Btrieve.
The Btr2xfh call converter is compatible with Btrieve 5.1x and above.
Btr2xfh and Extfh replace the modules supplied by Pervasive Software. All of the calls that would normally go to the Btrieve Record Manager are passed to Btr2xfh and are then passed to the COBOL file handling system.
The converter is supplied as a linkable module, btr2xfh.obj , which you should link with any application that is to perform I/O via Btr2xfh on COBOL files.
The entry point into the module is _BTRV and requires the same seven parameters that would normally be passed from a COBOL application to a Btrieve record manager.
The Btr2xfh module is designed to replace the COBOL interface module supplied with the Btrieve Software Developer's Kit by Pervasive Software.
The majority of Btrieve file operations behave in exactly the same way when Extfh is used. However, due to underlying differences between the two systems, there are instances where behavior differs. Those areas are:
Data compression
File operations
Indices
Key lengths
Key types
Page size
Record size
Stat operation
Each of these areas is described in the following sections.
Creating a file with data compression causes data and key compression to be used on the file.
The following Btrieve file operations are supported by Extfh:
Abort Transaction
Begin Transaction
Close
Create
Delete
End Transaction
Get Direct
Get Directory
Get Equal
Get First
Get Greater
Get Greater or Equal
Get Key
Get Last
Get Less than
Get Less than or Equal
Get Next
Get Position
Get Previous
Insert
Open
Set Directory
Stat
Step First
Step Last
Step Next
Step Previous
Unlock
Update
The locking and key-only operations are also supported.
Only permanent indices are supported. Once you have created a file you cannot add or delete a file index.
The total length of a single key in Extfh cannot exceed 1016 bytes. This is the sum of the lengths of any component making up a split or segmented key. The total number of key components in a file cannot exceed 255.
The following points apply to keys when using Btr2xfh:
Extfh has no concept of page size, so page size parameters are not required. Page size is not returned on a Btrieve Stat operation.
The maximum record size with Extfh is 62 Kbytes.
The bits set in the file flags and the fields set in the file specification in Extfh differ from those set when the Btrieve Stat operation is used. The following lists the bits and fields set when using the Stat operation. All other flags and fields are returned set to zero.
Bits set in the file flags:
variable length record
data compression
Bits set in the key flags:
duplicates allowed
key has another segment
The modifiable flag is always set.
Fields set in the file specification:
record length
number of indices
file flags (see above)
The following is a list of Btrieve error codes which have been adapted from the Btrieve Installation and Operations manual supplied by Pervasive Software. Where appropriate, an action to resolve the problem is given.
For each Btrieve error status, the COBOL status it is mapped to is also shown.
Returned as COBOL status: | 9/161 |
Returned as COBOL status: | 9/039 if performing an OPEN operation |
9/007 if performing a WRITE operation | |
9/033 if performing a different operation |
Returned as COBOL status: |
ansi 85 status: | 42 if performing a CLOSE operation | |
48 if performing a WRITE operation | ||
49 if performing a REWRITE/DELETE operation | ||
47 if performing a START/READ operation | ||
ansi 74 status: | 9/142 if performing a CLOSE operation | |
9/148 if performing a WRITE operation | ||
9/149 if performing a REWRITE/DELETE operation | ||
9/147 if performing a START/READ operation |
Returned as COBOL status: | 23 |
Returned as COBOL status: | 22 |
Returned as COBOL status: | 9/047 |
Returned as COBOL status: | 9/139 |
Returned as COBOL status: |
ansi 85 status: | 43 | |
ansi 74 status: | 9/143 |
Returned as COBOL status: | 23 if performing a START operation |
10 if performing a READ (sequential) operation |
Returned as COBOL status: | 21 |
Returned as COBOL status: | 9/004 |
Returned as COBOL status: |
ansi 85 status: | 35 | |
ansi 74 status: | 9/013 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/007 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/027 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/139 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/040 |
Returned as COBOL status: | 9/065 |
Returned as COBOL status: | 9/078 |
Page Size |
Max. Number Key Components |
---|---|
512 | 8 |
1024 | 23 |
1536 | 24 |
2048 | 54 |
2560 | 54 |
3072 | 54 |
3584 | 54 |
4096 | 119 |
Returned as COBOL status: | 9/139 |
Returned as COBOL status: | 9/139 |
Returned as COBOL status: | 9/078 |
Returned as COBOL status: | 9/039 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/009 |
Returned as COBOL status: | 9/040 |
Note that the XFH2BTR module will attempt to start a transaction on the first updating operation (REWRITE, WRITE, DELETE) after a file (with the WITH ROLLBACK clause specified in the SELECT statement) has been opened or after a COMMIT or ROLLBACK statement has been processed.
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/007 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/014 |
Returned as COBOL status: | 9/100 |
Returned as COBOL status: | 9/041 |
Returned as COBOL status: | 23 |
Returned as COBOL status: | 9/139 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: |
ansi 85 status: | 48 | |
ansi 74 status: | 9/148 |
Note that XFH2BTR attempts to perform an Update operation in order to detect record locks. Use the NODETECTLOCK directive is this error is returned and you are not performing a WRITE, DELETE or REWRITE operation.
It is not possible to specify an owner name when using XFH2BTR to access Btrieve files.
Returned as COBOL status: | 9/014 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/037 |
Returned as COBOL status: | 9/053 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/041 |
Returned as COBOL status: | 9/040 |
Returned as COBOL status: | 9/036 |
Returned as COBOL status: | 9/074 |
Returned as COBOL status: | 9/074 |
Returned as COBOL status: | 9/074 |
Returned as COBOL status: | 9/074 |
Returned as COBOL status: | 9/074 |
Returned as COBOL status: | 9/074 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/125 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/125 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/068 |
Returned as COBOL status: | 9/213 |
Returned as COBOL status: | 9/146 |
Returned as COBOL status: | 9/068 |
Returned as COBOL status: | 9/068 |
Returned as COBOL status: | 9/065 if performing an OPEN operation |
9/068 if performing a different operation |
Returned as COBOL status: | 9/014 |
Returned as COBOL status: | 9/014 |
Returned as COBOL status: | 9/065 |
Returned as COBOL status: | 9/040 |
Returned as COBOL status: | 9/040 |
Returned as COBOL status: | 9/040 |
Returned as COBOL status: | 9/077 |
Returned as COBOL status: | 9/037 |
Returned as COBOL status: | 9/124 |
Returned as COBOL status: | 9/040 |
Returned as COBOL status: | 9/126 |
Returned as COBOL status: | 9/125 |
Returned as COBOL status: | 9/100 |
Returned as COBOL status: | 9/033 |
Returned as COBOL status: | 9/025 |
Returned as COBOL status: | 9/025 |
Returned as COBOL status: | 9/025 |
Returned as COBOL status: | 9/025 |
Returned as COBOL status: | 9/025 |
Returned as COBOL status: | 9/025 |
Returned as COBOL status: | 9/025 |
Returned as COBOL status: | 9/025 |
Returned as COBOL status: | 9/025 |
Returned as COBOL status: | 9/025 |
COBOL status |
Btrieve Status |
---|---|
10 | 9 (if READ sequential operation) |
21 | 10 |
22 | 5 |
23 | 4, 9 (if START operation), 43 |
35 | 12 |
42 | 3 (if CLOSE operation) |
43 | 8 |
47 | 3 (if START/READ operation) |
48 | 3 (if WRITE operation), 46 |
49 | 3 (if REWRITE/DELETE operation) |
9/004 | 11 |
9/007 | 2 (if WRITE operation), 18, 38 |
9/009 | 35 |
9/013 | 12 |
9/014 | 40, 47, 86, 87 |
9/025 | 101, 102, 103, 104, 105, 106, 107, 109, 130, 133 |
9/027 | 20 |
9/033 | 2 (if not WRITE or OPEN operation), 14, 15, 16, 17, 19, 33, 54, 66, 67, 68, 69, 71, 72, 73, 75, 76, 77, 79, 100 |
9/036 | 59 |
9/037 | 51, 94 |
9/039 | 2 (if OPEN operation), 30 |
9/040 | 24, 36, 58, 90, 91, 92, 96 |
9/041 | 42, 56 |
9/047 | 6 |
9/053 | 53 |
9/065 | 25, 85 (if OPEN operation), 88 |
9/068 | 80, 83, 84, 85 (if non-OPEN operation) |
9/074 | 60, 61, 62, 63, 64, 65 |
9/077 | 13, 21, 23, 31, 32, 34, 37, 39, 45, 48, 49, 50, 55, 93 |
9/078 | 26, 29 |
9/100 | 41, 99 |
9/124 | 95 |
9/125 | 74, 78, 98 |
9/126 | 97 |
9/139 | 7, 22, 27, 28, 44 |
9/142 | 3 (if CLOSE operation) |
9/143 | 8 |
9/146 | 82 |
9/147 | 3 (if START/READ operation) |
9/148 | 3 (if WRITE operation), 46 |
9/149 | 3 (if REWRITE/DELETE operation) |
9/161 | 1 |
9/213 | 81 |
Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
Handling C-ISAM Files | Byte-stream File Handling |