Electronics
Btrieve
Motorcycling
Software

Btrieve bug reports and workarounds

BTRIEVE ERROR 154 on SUBST Drives
BTRIEVE v6.15 does not work with NT Client
Btrieve, TTS & Large Environments
Brequest & VIPX.386
Btrieve Extended Operations
Using Local and Requester DLLs
Key Position & Create Operation
Btrieve Pascal Examples
Btrieve DATE Data Type & Microsoft BASIC
Specifying Server Name/Volume Name in BLOG.CFG
Brequest Hangs If No Network Connection
Using BROLLFWD with Btrieve for DOS
Borland C++ & Btrieve
Running Brequest in an OS/2 DOS Box
Btrieve for Windows Load Parameters
Btrieve for OS/2 Prototypes
Validating Key Buffers with Btrieve for Windows & OS/2
TTS & Pre-Imaging
Windows, TBMI, VIPX.386, & DOS Applications
Pre-imaging in NetWare Btrieve v6.0
NetWare Btrieve v6.0 & Patch311.NLM
Using Brequest in Multiple Desqview Sessions
Status 2001 with WBTRCALL
Status 84 and Insert Operations
Btrieve v6.0 Page Size & NetWare v3.11
Rolling-Forward with Btrieve v5.x & v6.0
Btrieve for Windows & File Handles
BSPXCOM & SPX Sessions
Creating Btrieve Quick Libraries for Visual Basic for DOS
Get Next Extended Operation after Get Key
NetWare Btrieve & New Intel NE3200 Driver
Correct Usage of Btrieve Operation 42
Brequest v6.0 /L Option
File Level Access with Brequest v5.16 & v6.0
Btrieve Programmer's Manual Correction
Matching Btrieve Requester and DLLs
Open Btrieve Files & Non-Btrieve Apps
Status 96 & Windows Workstations
Configuring NetWare Lite for Btrieve
Btrieve Status 94 on Read-Only Files
Calling Btrieve from 32-bit Applications (Btrieve for OS/2 v5.10)
Defining UPPER.ALT ACS with Microsoft PDS BASIC v7.x
BTRIEVE.NLM & ELRDFX.NLM
Set Directory Operation Fails To Change Drive
Btrieve v5.x Status 109 (Transaction Too Complex)
New Btrieve Status 130 (Ran Out Of System Locks)
NetWare Btrieve v5.x Step Operations
Status 4 Occurs with Different Alternate Collating Sequences
Status 36 on Begin Transaction
Using BASIC FIELD statements with Btrieve for Windows
Changing Btrieve 5.10a Interrupt (Btrieve for DOS v5.10a)
Microsoft QuickBasic & Btrieve Status 76
Btrieve Overwrites Key Buffer with Status 22
Loading Brequest from Login Scripts
Ensuring Btrieve Transaction Recovery (Btrieve for DOS v5.10a)
IBM LAN Server Reports Sharing Violation with Btrieve
Btrieve Clients & SHARE.EXE
Btrieve NLM Allows Duplicate Records
NetWare Btrieve in Primary I/O Engine
When Does Btrieve Delete Delta Files?
Ascending Order & Autoincrement Keys
Status 95 & NetWare SFT III
Null Key Path & Status 44
New Btrieve NLM Configuration Option for 6.10x
Configuring Btrieve for Windows
Using Visual Basic Controls with Btrieve
Data Buffer Length & Get Next Extended
UC Option on Btrieve Extended Operations
NetWare OS/2 Requester Produces Status 95
Erroneous Status 82s and 2s (Btrieve for DOS 5.10a)
Establishing Multiple Btrieve Sessions Triggers Status 91
Synchronize logging and continuous ops


BTRIEVE ERROR 154 on SUBST Drives

When Windows has been run from a substituted drive (using SUBST.EXE), any database relation operation fails with the following error message:

Problem encountered in opening Database : 154

Error in accessing Transaction Control File

Solution is to modify BTI.INI to specify the location of the transaction file.

[Btrieve Client]
trnfile=j:\

where j: is the substituted drive.

BTRIEVE v6.15 does not work with NT Client

When attempting to use BTRIEVE for Windows v6.15, either the 16 or 32 bit versions, they fail using the Novell's NetWare Client for Windows NT v3.5. BTRIEVE works with the Microsoft Client, however.

In their 6.15 version, BTRIEVE makes calls specific to NWLINK, Microsoft's emulation of our IPX/SPX protocol. These calls are not supported by our client and are not standard IPX/SPX calls. BTI is aware of the problem.

Btrieve, TTS & Large Environments

In very large environments, Btrieve may respond slowly due to cache buffer/TTS conflicts. Customer sites that have reported this situation had Btrieve files flagged as "transactional" and were running very fast servers with large drives. For example, one of the sites was running an EISA-based server. Another site was running a server using a microchannel bus with fast network interface cards installed. In each case, the operatiing system's dirty cache was filling up. The term "dirty cache" refers to cache buffers whose information has been changed and needs to be written out to disk.

When dirty cache fills up, the cache is flushed, but during the write to disk, no transactions may take place, the Btrieve application is halted, and network communications can slow down. Cache buffers can fill up if the server is overloaded with TTS requests submitted by a large number of Btrieve NLM threads.

Btrieve may exhibit erratic behavior when the TTS back-out file, the file used by NetWare TTS to track updates to transactional files, grows large enough to fill the SYS volume. This situation occurs when the server is busy processing TTS requests and does not truncate the TTS back-out file. The default maximum truncation wait time is 59 minutes and 19.2 seconds. This can be too long in some environments. If a server is busy, it will wait the default period before truncating the back-out file. If a large number of transactions from multiple stations take place and the SYS volume is small, the back-out file grows until it exhausts all available space. At this time, Btrieve may return a status 14 (Pre-image Open Error) for each file in the transaction.

The system disk block size defined when the volum e is created during the INSTALL (rather than the record size) contributes to the size of the TTS back-out file. TTS writes to the back-out file on a block-by-block basis. For example, consider a system using 16k disk block sizes and records of 20 to 120 bytes in length. Each write to these records will consume 16k of the TTS back-out file. To avoid these situations:

Brequest & VIPX.386

In Windows 3.0 enhanced mode using versions of VIPX before v1.1, Brequest can hang in a DOS box. If you use the new version, VIPX.386 v1.1, with IPX.COM v3.10, Brequest will function properly in a Windows DOS box. VIPX.386 and IPX.COM v3.10 are available on NetWire in NOVLIB, Data Library 5.

To use VIPX.386, first generate a new IPX. Then, modify the SYSTEM.INI file under the heading, [386enh], by adding "VIPX.386" as follows:

[386enh]
network=vnetware.386,vipx.386

With this modification, the driver will load when Windows 3.0 loads.

Btrieve Extended Operations

When using extended operations, Btrieve returns a status 62 (Invalid Descriptor) after the first extended operation performs successfully. Since the descriptor information is stored as a union in C or a redefinition in COBOL, this data gets overwritten by the output data buffer when the first extended call is issued. Therefore, you must update the descriptor information before each extended operation. Using Local and Requester DLLs

With Btrieve Windows applications which access both local and server-based Btrieve files, after a local file has been accessed, any subsequent Btrieve operation to a server-based file will use the local Dynamic Link Library (DLL) instead of the Btrieve for Windows Requester DLL. To verify that this situation has occured in your application, use the BTRTOOLS Version command. The Version command should display both the local and requester DLL versions before running the application. After the application accesses a local Btrieve file, suspend the application, reload BTRTOOLS, and run Version again. If the Requester version is not displayed, your application is only accessing the local DLL.

This situation can only be detected when another Btrieve application accesses the same file via BREQUEST and returns a status 85 (File in Use) or 94 (Permission Error). To ensure that your Btrieve Windows application calls both DLLs properly, edit the local DLL with DEBUG.COM. Find the line in the code containing "WBTRCALL" and edit the hexidecimal bytes to read "WBTRLOCL." With this modification, the local DLL must always be used in combination with the Requester DLL.

Key Position & Create Operation

When creating a Btrieve file, you must specify a Key Position for each key segment. The Key Position is the starting position of the segment within the data record. If you specify a Key Position of zero, Btrieve will return a status 27 (Invalid Key Position).

The Key Position must be set to a value between one and the specified record length. This requirement also applies with BUTIL -CREATE operations and any application that performs a Btrieve Create (14) operation.

Btrieve Pascal Examples

The sample Pascal programs in the Btrieve Programmer's Manual (April 1990 edition) were written with Microsoft Pascal. Turbo Pascal programmers cannot use these example programs without modification because of differences in the way the two languages manage "string" variables. In Turbo Pascal, a variable declared as "string[4]" is actually five bytes long, because it includes a length byte indicating the significant amount of data in the remaining four bytes. Btrieve does not expect a length byte, and interprets it as a general data byte.

For instance, the Btrieve Create example in Appendix D results in a status 25 (Create I/O Error), a status 27 (Invalid Key Position) or possibly other errors if used in a Turbo Pascal program. The following changes should be made in order for the Btrieve Create example program to function properly:

  1. The key specification must include a four-byte "Not used" field. In the sample program, this field is declared as "NOT_USED : string[4];" which is actually a five-byte field. This will cause a status 27 to be returned on the Btrieve Create call. Change this variable to "NOT_USED : ARRAY [1..4] OF char;"
  2. Similarly, the file specification includes a four-byte "Not used" field, as well as a two-byte "Reserved" field. The sample program declares the fields as "NOT_USED : string[4];" and "RESERVED : string[2];" respectively. These may also produce a status 27 on the Btrieve Create call. Change the data type of these fields to ARRAY [1..x] OF char.
  3. The KeyBuffer parameter passed on the Btrieve Create call must contain the name of the file to be created. The example uses a variable declared as: "FILE_NAME : string[17];" and then calls Btrieve with this variable as the key buffer (fifth) parameter. When Btrieve reads FILE_NAME, it reads the length byte first, which usually is not a legal character for a DOS file name, and a status 25 will be returned.
To avoid problems, either declare this parameter as an "ARRAY [1..x] OF char" or pass it to Btrieve with a [1] subscript. For example:

STATUS := BTRV (B_CREATE, POS_BLK, DATA_BUF, DATA_LEN, FILE_NAME[1], 0);

Many of the sample Pascal programs in the Btrieve Programmer's Manual also define the data buffer with a variant record. This is not necessary in Turbo Pascal. For example, when converting the Pascal Get First example from Appendix D (see Figure 7) to Turbo Pascal, you can use a simple record type, as shown in Figure 8. Then, specify DATA_BUF as the third parameter.

FIGURE 7: Excerpt from Pascal Get First example in Btrieve manual

type EMP_REC = record case integer of 1: (NAME : string(20); AGE : string(2); HIRE_DATE : string(6)); 2: (ENTIRE : string(28)); end; var DATA_BUF : EMP_REC; ... begin ... STATUS := BTRV(B_GET_FIRST, POS_BLK, DATA_BUF.ENTIRE, DATA_LEN, KEY_BUF, 2);

End of Figure 7

FIGURE 8: Turbo Pascal modifications to Get First example

type EMP_REC = record NAME : string[20]; AGE : string[2]; HIRE_DATE : string[6] end; ... STATUS := BTRV( B_GET_FIRST, POS_BLK, DATA_BUF, {Use "DATA_BUF" as 3rd parameter} DATA_LEN, KEY_BUF, 2);

End of Figure 8

Btrieve DATE Data Type & Microsoft BASIC

When developing Btrieve applications with Microsoft BASIC PDS 7.X or Visual Basic v1.0, the Btrieve DATE data type is required to sort on a date field. The DATE data type field is stored internally as a four-byte value. The day and month are each stored in one-byte binary format. The year is stored as a two-byte integer value. The day is in the first byte, the month is in the second byte, and the year is a two-byte integer following the month.

To efficiently sort on a date field, create a structure using the user-defined TYPE and END TYPE statements for the key buffer.

TYPE Date Day AS STRING * 1 Month AS STRING * 1 Year AS INTEGER END TYPE

Then, name the structure using the DIM statement for BASIC PDS 7.X:

DIM Birthdate AS Date

Or, name the structure using the Globalstatement for Visual Basic v1.0:

Global Birthdate AS Date

Next, assign values to these variables using the MKI$ or the CHR$ functions. (Visual Basic v1.0 does not support the MKI$ function, so you must use the CHR$ function instead.) Since the day and month variables need to be stored as a one-byte string, the integer values must be converted to string values using the MKI$ or CHR$ function as shown below.

Birthdate.Day = MKI$(20) Birthdate.Month = MKI$(6) Birthdate.Year = 1999

OR

Birthdate.Day = CHR$(20) Birthdate.Month = CHR$(6) Birthdate.Year = 1999

The MKI$ function converts a two-byte integer to a two-byte string. The CHR$ function converts a decimal value to its equivalent ASCII character. Since the day and month variables will never exceed 255, only the low-order byte is being manipulated. Either function will store the same value.

Once these values have been inserted into the Btrieve file, the same birthdate structure can be used to retrieve data with a GET operation. Once the record is returned into the birthdate structure, convert the day and month variables back to their numeric values.

(For BASIC PDS v7.x)

CALL BTRVFAR(GETFIRST%, PosBlk$, VARPTR(Birthdate), VARSEG(Birthdate), _BufLen%, KeyBuf$, KeyNum%)

(For Visual Basic v1.0)

Status%=BTRCALL(GETFIRST%, PosBlk$, Birthdate, BufLen%, KeyBuf$, KeyBufLen%, KeyNum%)

The conversion can be accomplished with the ASC function which returns the numeric value of the equivalent ASCII character.

Day% = ASC(Birthdate.Day) Month% = ASC(Birthdate.Month) Year% = Birthdate.Year

Specifying Server Name/Volume Name in BLOG.CFG

If the file, BLOG.CFG, uses ServerName or VolumeName to specify the path to the BROLLFWD log file, BROLLFWD will return the error message, "Cannot find log file." However, if a drive letter is specified instead of ServerName and VolumeName, BROLLFWD will work correctly.

To ensure that BROLLFWD functions properly, use a drive letter to specify the path to the log file.

Brequest Hangs If No Network Connection

Attempting to load BREQUEST.EXE v5.16 on a workstation that does not have a network connection will hang the workstation. Make sure the NetWare shell is loaded before attempting to load Brequest. If you load Brequest from the AUTOEXEC.BAT file, check the DOS ERRORLEVEL after loading the network shell. If ERRORLEVEL equals one, do not load Brequest. Add the following code to your AUTOEXEC.BAT to test for this condition.

SET B_LOAD=YES IPX NETX IF ERRORLEVEL 1 SET B_LOAD=NO ... IF %B_LOAD% == YES BREQUEST /D:8192 SET B_LOAD= ...

Using BROLLFWD with Btrieve for DOS

The Btrieve for DOS Installation and Operation Manual discusses how to log Btrieve files to another volume on the server. However, it does not describe how to log a Btrieve file to another physical hard drive or mapped drive.

To log a Btrieve file to another physical drive, make an entry in the BLOG.CFG file in the following format:

[BFILE=LOGFILE]

In this entry, "BFILE" is the absolute pathname of the Btrieve file to be logged without the drive letter (it must begin with a backslash (\) character). "LOGFILE" is the absolute pathname to the associated log file including the drive letter.

For example, if a Btrieve file called TEST.BTR resides on the server in the F:\DATA directory and the log file is located on a local hard drive (C:\BTR\LOG\TEST.LOG), the entry in the BLOG.CFG file should be:

\DATA\TEST.BTR =C:\BTRIEVE\LOG\TEST.LOG

This information applies to Btrieve for DOS only. With NetWare Btrieve, do not specify a drive letter for either the Btrieve filename or the logfile.

Borland C++ & Btrieve

Name Mangling is an attribute of the Borland C++ compiler which allows multiple definitions of functions within an application. Name mangling is documented in Chapter One of the Borland C++ Programmer's Guide, v2.0.

This attribute is not compatible with the WBTRINTF.C file supplied with Btrieve for Windows v5.10. When you link a program, unresolved externals can appear and the linker may return "unresolved external btrv()" errors. The linker will also return all functions defined in the C file in lower case (Btrieve for Windows prototypes and functions do not contain a lower case "btrv()"). This situation occurs because the C file is compiled as a C++ file and consequently the compiler applies name mangling to the BTRV function and every other function defined.

To disable the name mangling attribute, set a compiler directive to treat functions as regular C functions if files are being compiled as C++ files by default. The directive is:

#ifdef __cplusplus extern "C" { endif #ifdef __cplusplus } endif

With this directive in place, functions between the two statements will be treated as standard C functions and name mangling will not be performed. Function prototypes can be defined in a series of include files which can be placed between the compiler directives. For example, WBTRV.H could be included between the directives and then the function BTRV would not be mangled by the compiler. There are many ways to implement this directive, but the compiler will mangle function definitions if you do not use some implementation.

Running Brequest in an OS/2 DOS Box

BREQUEST.EXE will not run in an OS/2 DOS box on OS/2 v1.3 because of incompatibilities between the SPX APIs in the DOS box and OS/2. If you run DOSBOX.EXE with BREQUEST.EXE, the error "IPXOpenSocket Failed" will be returned. This problem cannot be corrected in v1.3 of the NetWare OS/2 requester.

Btrieve for Windows Load Parameters

With the local requester, WBTRCALL.DLL, every Windows session can specify different Btrieve load parameters if each application calls the WBTRVINIT function. This call allows you to pass a string containing the Btrieve load parameters, and should be the first Btrieve call made by your application.

If you do not use the WBTRVINIT call, then the load parameters specified in the "[btrieve]" section of WIN.INI will be used. If there is no "[btrieve]" section in WIN.INI, the local requester is loaded with default parameter values.

When you use WBTRCALL.DLL, the Btrieve load parameters are essentially "global" since they can only be specified in the "[brequestDPMI]" section of the WIN.INI file. The WBRQSHELLINIT call is not currently implemented to initialize the WBTRCALL.DLL requester from within an application.

Btrieve for OS/2 Prototypes

The local version of Btrieve for OS/2 v5.10 (BTRCALLS.DLL) works with OS/2 v2.0, but OS/2 v2.0 developers writing 32-bit applications or DLLs to call the 16-bit BTRCALLS.DLL must modify the interface in order to alias the 32-bit pointer and integer parameters. IBM C Set/2 provides macros you can use to make these changes.

Calling the 16-bit Btrieve for OS/2 v5.10 DLL is a simple matter of rewriting the BTRCALL() prototype. The current prototype for OS/2 v1.X is shown in part A of Figure 2. The prototype for a 32-bit application or DLL is shown in part B. With IBM C Set/2,everything else is handled by the compiler and linker. (Btrieve for OS/2 applications written for OS/2 v1.X will run successfully under OS/2 v2.0.)

FIGURE 2: BTRCALL prototypes for OS/2

Part A: Prototype for OS/2 v1.x

extern int APIENTRY BTRCALL (USHORT, PSZ, PSZ, PUSHORT, PSZ, CHAR,UCHAR);

Part B: Prototype for a 32-bit application or DLL

extern SHORT APIENTRY16 BTRCALL (USHORT, UCHAR _Seg16 *, UCHAR _Seg16 *, USHORT _Seg16 *, UCHAR _Seg16 *, CHAR, UCHAR); End of Figure 2

Validating Key Buffers with Btrieve for Windows & OS/2

The client version of Btrieve for Windows will validate pointers when using the "tracefile= " line in the [Btrieve]paragraph of WIN.INI. When using NetWare Btrieve and the requester for Windows, setting "chkparms=yes" in the [BrequestDPMI] paragraph will validate pointers. Client versions of Btrieve for OS/2 will validate pointers when the environment variable, "BTRPARMSCHK," is set equal to "YES."

Btrieve validates the pointer parameters passed in for read/write access over certain ranges. If the pointers passed to Btrieve do not have access to memory specified by the pointers, a status 1015 will be returned. If you are using the "tracefile=" method, Btrieve for Windows will return "INVALID POINTER parameter #?" in your tracefile, where "?" would be one to four referring to the position block, data buffer, data buffer length, and key buffer respectively.

The key buffer parameter is always evaluated for the maximum number of bytes (255) regardless of what is specified in the key buffer length parameter. So, to use pointer validation effectively,allocate the key buffer parameter as a pointer to a block of 255 bytes.

TTS & Pre-Imaging

If TTS is disabled at the server and the Btrieve data files to be accessed with the NetWare Btrieve v5.15 are flagged "transactional" (T), Btrieve will return a status 15 (Pre-image I/O Error) on all updates (Insert, Update and Delete operations) to the data files between Begin Transaction (19) and End Transaction (20) operations.

The status 15 is not returned when:

In all cases, even when the status 15 is not returned, no pre-imaging is performed if TTS is not enabled at the server.

If Btrieve data files are flagged transactional, TTS must be enabled at the server for pre-imaging to be performed. When TTS is disabled, flag all Btrieve files non-transactional (-T).

Windows, TBMI, VIPX.386, & DOS Applications

Within Windows, running Brequest and a DOS application in a DOS box requires different setups depending on which version of Windows you use and whether or not you run Windows in standard mode or enhanced mode.

After starting Windows, load BREQUEST.EXE in the DOS box, and then load the DOS application. Use the VIPX.386 that is included in WINUP6.ZIP on NetWire. Do not use the version included with Windows v3.0.

If a Windows application (not DOS) requires BREQUEST.EXE, then load BREQUEST.EXE before you start Windows.

Pre-imaging in NetWare Btrieve v6.0

NetWare Btrieve v6.0 creates a pre-image file when writing to a Btrieve file created with an earlier version of Btrieve. However, the format of this pre-image file is different from the format of a pre-image file created by earlier versions of Btrieve. Earlier versions of Btrieve cannot accurately interpret a pre-image file created by NetWare Btrieve v6.0 and vice versa.

If you need to interchange the Btrieve engine that will be accessing the pre-v6.0 Btrieve file, all pre-image files must be cleaned up prior to swapping engines. Use the following procedure to clean up these pre-image files:

  1. Check to see if a .PRE file exists for any Btrieve files
  2. If a .PRE file exists with a pre-v6.0 version of Btrieve:
    • open the Btrieve file in Exclusive mode
    • perform a Get First operation
    • perform an Update operation
    • close the Btrieve file (this should cause the .PRE file to be deleted)
  3. Switch engines

Remember that a Btrieve file can not be accessed simultaneously with a client Btrieve engine and the NetWare Btrieve server-based engine. This procedure should be used if it is necessary to swap between a pre-v6.x client engine and a v6.x server engine.

NetWare Btrieve v6.0 & Patch311.NLM

When using BTRIEVE.NLM v6.0 with NetWare v3.11, make sure that PATCH311.NLM (the patch file for the version of CLIB.NLM released with NetWare v3.11) is in the SYS:\SYSTEM directory before you attempt to load BTRIEVE.NLM, regardless of which version of CLIB.NLM the networkuses. BTRIEVE.NLM v6.0 always attempts to automatically load this patch file. PATCH311.NLM will only load if the released CLIB.NLM is running. If the system uses a newer version of CLIB.NLM, PATCH311.NLM will detect it and do nothing. As long as the Btrieve NLM can locate the patch file, it will load whether PATCH311.NLM successfully loads or not.

Using Brequest in Multiple Desqview Sessions

With Desqview v2.40, if you have multiple sessions running Btrieve applications using the NetWare Btrieve requester (BREQUEST.EXE), Btrieve may return a status 79 (Programming Error). The Desqview v2.40 configuration option, "Network Buffers," can be increased to resolve this status code.

From a Desqview window, run the program DVSETUP. Then, select the advanced setup procedure. From the advanced menu, select the Network option. One of the network options is called "Network Buffers." The default for this parameter is 8. Raising this value to 16 will usually resolve the status 79.

Status 2001 with WBTRCALL

With the Windows Btrieve requester, WBTRCALL.DLL v5.17a (date: 6-28-91), Btrieve returns a status 2001 (Insufficient Memory) on any Btrieve call issued after a WBTRVSTOP call. The status 2001 only occurs within a single task or program. If an application that makes Btrieve calls is running and that application, or any other application calls WBTRVSTOP, the NetWare Btrieve NLM will return a status 2001 on each successive Btrieve call in all Btrieve applications that are running until the applications are restarted.

This situation has been resolved in the version of WBTRCALL.DLL (NetWare Btrieve v6.0) that ships with NetWare SQL (NLM) v3.0. If you use the v6.0 WBTRCALL.DLL, you also need WBTRVRES.DLL (also included with NetWare Btrieve v6.0).

Status 84 and Insert Operations

A status 84 (Record in Use) is a valid status code on an Insert operation. Insert operations occasionally return this status code when a stress test is conducted with several PCs. NetWare Btrieve returns this status code because it is locking the key page for a brief period of time to update key information. At this time, if a user tries to insert records that are indirectly accessing the key page, the Insert operation will result in a status 84.

To avoid this situation, design your applications to trap for status 84s and retry the Insert operation.

Btrieve v6.0 Page Size & NetWare v3.11

If the page size of a Btrieve data file is not evenly divisible into 4096 (is NOT 512, 1024, 2048 or 4096), the file may become corrupted. The NetWare v3.11 patch, ASNCRDFX.NLM (Async Read Fix), fixes this problem. This patch is available on NetWire (NOVLIB, 311PT9.ZIP).

Rolling-Forward with Btrieve v5.x & v6.0

Log files created with Btrieve v5.x can only be rolled-forward with Btrieve v6.0 under certain circumstances. The following list describes each possibility.

  1. Log files created with Btrieve v5.x can be applied to v5.x files with the v6.0 xBROLL utilities (DBROLL, PBROLL, WBROLL).
  2. Log files created with Btrieve v6.0 are not compatible with the v5.x roll-forward utilities (BROLLFWD and WBROLL 5.x) and cannot be used with the 5.x utilities.
  3. If a single log file contains entries that were created by both Btrieve v5.x and Btrieve v6.0 (using the xBROLL v6.0 utilities), if the first entry was created by Btrieve v5.x, only the v5.x entries in the log file will be applied. If the first entry in the log file is created by Btrieve v6.0, the xBROLL v6.0 utilities will only apply to the v6.0 entries.
  4. If a log file is created with Btrieve v5.x, the changes in the log file can be applied to a Btrieve file with the xBROLL utilities multiple times. If a log file is created by Btrieve v6.0, (even if the data file is a v5.x format file), once xBROLL is used to apply the changes to a Btrieve file, the entries in the log file are marked as "used" and cannot be applied again to a data file using xBROLL.
Btrieve for Windows & File Handles

Btrieve for DOS and Btrieve for Windows manage handles differently. Btrieve for DOS v5.10a allocates its own Program Segment Prefix (PSP) with a file handle table of size (/f parameter * 2) entries (with patch #99 applied). Btrieve for DOS does not use the calling application's file handles. This means that when a DOS application has opened 20 Btrieve files, the application still has 15 handles (20 DOS default handles minus 5 standard handles) available for use to issue DOS Open calls to non-Btrieve files.

Btrieve for Windows manages handles using the calling application's file handle table. When the application's available handles are exhausted, WBTRCALL will "rotate" the handles as in versions of Btrieve for DOS prior to v5.10. Once 15 Btrieve files are open, there are no handles available to the calling application for DOS Open calls to non-Btrieve files, since DOS will not rotate handles.

At this point, if another Btrieve Open call is issued, WBTRCALL will close one of its open files and use the handle to open the new file. This process occurs invisibly to the application and WBTRCALL can handle up to its current "/f:" parameter of rotating files at one time.

WBTRCALL will use whatever application handles are available. If DOS Open calls to non-Btrieve files are needed along with more than 15 Btrieve Opens, one solution is to open the DOS files before the Btrieve files. Otherwise, you could increase the number of handles available to the application at compile time. The process of increasing the number of open files to more than the default 20 varies depending on which compiler you use.

BSPXCOM & SPX Sessions

BSPXCOM.NLM appears to hang after running out of sessions if users continuously try to obtain an SPX session with Btrieve after exceeding the limit. The workstation receives either a status 95 (Session No Longer Valid) or a status 91 (Server Error). This situation occurs in both the NetWare Btrieve v5.x and NetWare Btrieve v6.0 environments. Once BSPXCOM.NLM hangs, Btrieve must be unloaded and reloaded.

To avoid this situation, apply the NetWare patch, SPXFIX1.NLM which is available on NetWire with the NetWare operating system patches (LIB 5, filename 311PT9.ZIP).

Creating Btrieve Quick Libraries for Visual Basic for DOS

When developing Btrieve applications using the Microsoft Visual Basic for DOS interpreter environment (VBDOS), you must create a Quick Library that includes the required Btrieve interface. To create this Quick Library, use the following link command:

Link /q BC7RBTRV.OBJ, BC7.QLB,, VBDOSQLB.LIB;

where BC7RBTRV.OBJ is the Btrieve interface, BC7.QLB is the name of the Quick Library, and VBDOSQLB.LIB is the name of the required library. To load the Visual Basic for DOS environment to include the newly created Quick Library execute the following command:

VBDOS /L BC7

Get Next Extended Operation after Get Key

If you use the GetKey bias (+50) when establishing positioning before a Get Next Extended (38) operation, the extended operation will not function properly, returning either a status 19 (Unrecoverable Error) or erroneous information in the databuffer. This situation occurs with Btrieve for DOS v5.10a and NetWare Btrieve v5.15.

Patch #57, available on Novell's NetWire forum on CompuServe (NOVLIB, LIB 7), resolves the situation for NetWare Btrieve v5.15. There is currently no patch for Btrieve for DOS v5.10a, so avoid using the GetKey bias before Get Next Extended operations. Instead, use a Get First (12), Get Equal (5), or some other operation to establish positioning without the +50 bias.

NetWare Btrieve & New Intel NE3200 Driver

File corruption can occur when you use Intel's NE3200.COM driver (09-03-91, 19242 bytes) in conjunction with Intel's EtherExpress 32bit card on workstations running Btrieve applications. Intel describes the situation as:

"... a problem with the Ether-Express 32 and applications that use extended memory or memory managers (i.e. MicroSoft Windows 3.x). Previous versions of this driver would not protect memory regions from the above mentioned applications. This could cause files that the EtherExpress 32 stored in memory to be overwritten (corrupted) if an application wrote to that address space."

Intel has a new NE3200.COM driver (date: 05-04-92, size: 25967) which fixes these problems through the use of the keyword "DOUBLE BUFFER" in the NET.CFG file. This driver is still in Beta and has not completed certification. This driver defaults to an 802.2 frame type; if you need a different frame type, include a "FRAME" statement in the NET.CFG file. Figure 5 contains a sample NET.CFG file. Note that this file requires the NE3200.COM driver to be in the same directory as itself.

FIGURE 5: Sample NET.CFG file for NE3200.COM driver LINK DRIVER NE3200 SLOT 5 DOUBLE BUFFER FRAME ETHERNET_802.3 PROTOCOL IPX 0 ETHERNET_802.3 PROTOCOL IPX BIND NE3200 END of FIGURE 5

Correct Usage of Btrieve Operation 42

The new NetWare Btrieve v6.0 operation 42, used to place Btrieve files into Continuous Operation mode (and return them to normal mode), can only be called from an NLM application. It cannot be called from a workstation application. If a workstation attempts to perform a Btrieve operation 42, NetWare Btrieve v6.0 returns a status 20 (Btrieve Not Loaded). NetWare Btrieve v5.x will return a status 1 (Invalid Operation).

Brequest v6.0 /L Option

In Brequest v6.0x, an new undocumented load option, /L, allows you to load another instance of Brequest even if Brequest is already loaded. This option is useful if you want to run Windows applications utilizing the Btrieve requester while running DOS VM applications that use Brequest.

To run Windows applications that use the Btrieve requester, Brequest must be loaded before starting Windows. In order to run DOS applications in Windows, Brequest must be loaded in each DOS session. However, if Brequest is loaded outside of Windows, it cannot be loaded again in a DOS session.

For Windows applications utilizing the Btrieve requester, load Brequest outside of Windows. In each Windows DOS session that will be running a Btrieve application, load Brequest with the /L option. Doing so will load another instance of Brequest that is only available to the DOS session. Doing so provides the DOS session with its own copy of Brequest and prevents the DOS session from using the instance of Brequest that was loaded before Windows was started.

File Level Access with Brequest v5.16 & v6.0

With Brequest v5.16, users are allowed to write to a Btrieve file if the user has "Write" access to the directory, even if the user does not have "Write" access to the file.

This situation does not occur with Brequest v6.0, since Brequest v6.0 uses file-level access rather than directory- level access. If a user has "RWCEMFA" access to a directory but only "RF" (read and file scan) access to a file, Brequest v6.0 returns a status 94 (Permission Error) on the Open operation.

"Supervisor" access to a directory works differently. If a user has "Supervisor" access, any file can be opened regardless of which requester is in use. "Supervisor" rights override all inherited rights masks in subdirectories and files.

Btrieve Programmer's Manual Correction

The Btrieve Programmer's Manual for the v6.0 SDK incorrectly documents the Filter Portion for the Get Next Extended (36) operation, Get Previous Extended (37) operation, and Step Next Extended (operation 38) operations.

On page 4-69 and 4-83 the Get Next Extended and Get Previous Extended operation Filters are documented as:

1 Byte Data type of field 2 Byte Length of field 1 Byte Comparison code

On page 4-131, the Step Next Extended operation Filter is documented as:

1 Byte Data type of field 2 Byte Offset of field 1 Byte Comparison code

Each of the extended retrieval operations should specify a filter as on page 4-141 for the Step Previous Extended operation Filter:

1 Byte Data type of field 2 Byte Length of field 2 Byte Offset of field 1 Byte Comparison code

Matching Btrieve Requester and DLLs

Btrieve can return status 97 (Data Message Too Small) on Create operations with a Windows application if improper versions of the Btrieve Requesters and DLLs are used. However, this status code will not be returned at all workstations; some workstations will run the application without problems.

This situation results from leaving different versions of WBTRCALL.DLL in directories or having an inappropriate DLL in the default drive. If you have several DLLs in your path statement, Windows will search for DLLs in the following order:

If you want to use both the client and requester versions of WBTRCALL.DLL, the client version must be converted WBTRLOCL.DLL with the WNDBCNUT.EXE utility. Make sure that you are always using the latest requesters available; currently BREQUEST.EXE v6.00b and WBTRCALL.DLL v6.00c. Make sure that no other versions of these two DLLs exist in other directories specified in your PATH statement. Otherwise, Btrieve may return the message "Requester not loaded," seemingly inappropriate status codes or the system may generate a general protection fault (GPF).

Open Btrieve Files & Non-Btrieve Apps

If Btrieve v6.0 opens files, they can still be accessed by a non-Btrieve application (like a DOS v5.0 COPY) without generating a Sharing Violation error. This situation does not arise with pre-6.0 versions of Btrieve and is not the result of a bug.

BTRIEVE.NLM v6.0 opens files differently than earlier versions of Btrieve. With Btrieve v6.0, files are first opened in Shared Read mode by the foreground process and, when data is written to the files, they are reopened by the Background Writer in exclusive Write, Shared Read mode. Versions of Btrieve before v6.0 opened the files with one exclusive Read/Write handle.

If you use BTRIEVE.NLM v5.x, the following scenario applies:

With Btrieve 6.0, the outcome is different. To ensure database integrity when backing up files, either:

Status 96 & Windows Workstations

When using the NetWare Btrieve NLM v5.15, a status 96 (Communications Environment Error) means that the SPX connection table is full. This status can usually be prevented by increasing the Number of Sessions configuration option through BSETUP. However, Windows workstations that run multiple Btrieve applications simultaneously require more than one session per workstation. In this case, NetWare Btrieve can return a status 96 when the Number of Sessions is set to the maximum of 250 and BCONSOLE shows only 225 sessions being used. BCONSOLE only shows one session per Windows workstation even if multiple Btrieve applications are running on that workstation.

The June 1990 Bullets article, "Btrieve NLM Parameters," shows that the maximum setting for the Btrieve "-s" (number of sessions) parameter is 500. This number is twice the maximum setting for the BSPXCOM "-s" (number of concurrent sessions) parameter. In reality, the Btrieve "-s" parameter can be increased even more to prevent a status 96 when using Windows workstations. The Btrieve "-s" parameter can be modified in the BSTART.NCF file. The maximum setting is approximately 35,000, and the memory consumption is approximately 100 bytes for each session. After making any changes to BSTART.NCF, be sure to unload the Btrieve NLM (type "BSTOP" at the server console) and reload the Btrieve NLM (type "BSTART") for the changes to take effect.

Configuring NetWare Lite for Btrieve

With NetWare Lite, there are two ways to access files from the server while ensuring you are using the same drive letter that the other clients are using. One method is to execute a "DOS SUBST" command at the server. For example:

SUBST F: C:\

After executing this command, when you access the F: drive, the files actually being accessed are at the root of the C: drive. This command can be performed from the command line or inside a batch file. This can be done before or after loading the server/client software. The clients will then NET MAP their F: drives to the root of the server, and will be looking at the same files as the server.

In this situation, all I/O requests sent from the server for files are being handled by DOS and NOT the NetWare Lite redirector (the CLIENT.EXE software). As a result, NetWare Lite file sharing mechanisms are not being used, which may produce a Btrieve status 2 (I/O Error), or situations where incorrect data is returned to the application. For example, while the server was inserting data into a Btrieve file, and another client was attempting to read this data, the other client would occasionally be returned a partial record, as if it was reading the record that was still in the process of being inserted.

To make sure all file sharing is handled properly by the NetWare Lite redirector, there are two alternatives:

Btrieve Status 94 on Read-Only Files

If a Btrieve data file is flagged "read-only," performing an Open operation on the file with NetWare Btrieve (NLM) v5.15 will return a status 94 (Permission Error). This status will return even if the user has all rights in the directory and the file is opened in "read-only" mode through Btrieve.

When using NetWare Btrieve (NLM) v5.15, do not flag Btrieve data files "RO." To prevent "write" access to the files, use directory level rights of Read and File Scan.

With NetWare Btrieve (NLM) v6.x, the status 94 will not be returned if the file is flagged "RO." A "read-only" Open operation on the file will succeed, while a status 46 (Access to File Denied) will be returned when a user attempts to write to the file.

Calling Btrieve from 32-bit Applications (Btrieve for OS/2 v5.10)

The current Btrieve for OS/2 engine, v5.10, is a 16-bit DLL. In order to access this DLL from a 32-bit OS/2 application, the Btrieve entry points have to be "thunked." Some aspects of this process depend on which compiler you use. Figure 6 illustrates the process when using Borland's 32-bit OS/2 compiler. Figure 7 demonstrates the process for IBM's C-Set/2 OS/2 compiler.

FIGURE 6: "Thunking" Btrieve entry points with Borland's 32-bit OS/2 compiler #include ... #define FPSZ char __far16 * /* Far pointer to null-terminated string */ #define FPUSHORT USHORT __far16 * /* Far pointer to unsigned short */ extern USHORT __far16 __pascal BRQSHELLINIT (FPSZ); extern USHORT __far16 __pascal BTRVINIT (FPSZ); extern USHORT __far16 __pascal BTRVSTOP (void); extern USHORT __far16 __pascal BTRCALL (USHORT, FPSZ, FPSZ, FPUSHORT, FPSZ, BYTE, CHAR);

USHORT BTRV (USHORT, PSZ, PSZ, PUSHORT, PSZ, SHORT); void main() { . . . } /* Borland C++ interface to the Btrieve OS/2 dynamic link library */ USHORT BTRV (USHORT operation, PSZ posblock, PSZ databuf, PUSHORT datalen, PSZ keybuf, SHORT keynum) { BYTE keylen = 255; CHAR ckeynum = keynum;

return (BTRCALL (operation, posblock, databuf, datalen, keybuf, keylen, ckeynum)); } END of FIGURE 6

FIGURE 7: "Thunking" Btrieve entry points with the C-Set/2 32-bit OS/2 compiler #include ... extern USHORT _Far16 _Pascal BTRCALL (USHORT, PSZ, PSZ, PUSHORT, PSZ, BYTE, CHAR); extern USHORT _Far16 _Pascal BTRVINIT (PSZ); extern USHORT _Far16 _Pascal BTRVSTOP (void); extern USHORT _Far16 _Pascal BRQSHELLINIT (PSZ); USHORT BTRV(USHORT, PSZ, PSZ, PUSHORT, PSZ, SHORT); main() { . . . } /* IBM C-Set/2 interface to Btrieve OS/2 DLL */ USHORT BTRV (USHORT operation, PSZ posblock, PSZ databuf, SHORT datalen, PSZ keybuf, SHORT keynum) { BYTE keylen = 255; CHAR ckeynum = keynum;

return (BTRCALL (operation, posblock, databuf, datalen, keybuf, keylen, ckeynum)); } END of FIGURE 7

Defining UPPER.ALT ACS with Microsoft PDS BASIC v7.x

Using PDS BASIC 7.X, if you want to define an alternate collating sequence to a particular key, then in the Btrieve Create operation, you must allocate 265 bytes at the end of the File Specification structure after all of the file and key specifications variables. The code segment in Figure 8 demonstrates one method for performing this allocation.

FIGURE 8: Defining UPPER.ALT alternate collating sequence with PDS BASIC v7.x DEFINT A-Z REM **** GLOBAL CONSTANTS Const BCreate = 14 Const BString = 0 Const Duplicates = 1 Const Modifiable = 2 Const Sequence = 32 Const ExtendedType = 256 TYPE KeySpec KeyPos AS INTEGER KeyLen AS INTEGER KeyFlags AS INTEGER KeyTot AS LONG KeyType AS STRING * 1 Reserved AS STRING * 5 END TYPE TYPE FileSpec RecLen AS INTEGER PageSize AS INTEGER IndxCnt AS INTEGER NotUsed AS STRING * 4 FileFlags AS INTEGER Reserved AS STRING * 2 Allocation AS INTEGER KeyBuf AS KeySpec AltColSeq AS STRING * 265 END TYPE DIM FileBuf AS FileSpec FileName$ = "SAMPLE.BTR " PosBlk$ = SPACE$(128) REM ************* SET UP FILE SPECS ************* FileBuf.RecLen = 20 FileBuf.PageSize = 1024 FileBuf.IndxCnt = 1 FileBuf.FileFlags = 0

REM ************* SET UP KEY SPECS *************** FileBuf.KeyBuf(0).KeyPos = 1 FileBuf.KeyBuf(0).KeyLen = 20 FileBuf.KeyBuf(0).KeyFlags = ExtendedType + Modifiable + Duplicates + Sequence FileBuf.KeyBuf(0).KeyType = MKI$(BString) REM **** COPY 265 BYTES OF UPPER.ALT TO STRUCTURE VARIABLE OPEN "UPPER.ALT" FOR BINARY AS #1 LEN = 265 GET #1,1,FileBuf.AltColSeq CLOSE #1 BufLen = LEN(FileBuf) CALL BTRVFAR(BCreate, STATUS, PosBlk$, VARPTR(FileBuf), VARSEG(FileBuf), BufLen, FileName$, 0) IF STATUS <> 0 THEN PRINT"Error Creating File. Status = ";STATUS%;" Press a key to continue" DO LOOP WHILE INKEY$="" END ELSE PRINT"File SAMPLE.BTR Created Successfully!" END IF END END of FIGURE 8

BTRIEVE.NLM & ELRDFX.NLM

NetWare v3.11 server performance degrades severely or hangs during heavy read/write Btrieve operations. This issue has been resolved with the NetWare patch, ELRDFX.NLM. This patch was previously provided in the NetWare v3.11 patch kit (311PTx), but has been removed to call attention to the fact that if VREPAIR is run while this patch is loaded, data corruption can result. The patch is now available on NetWire in the NSD area (ELRDFX.ZIP).

There is also a third-party companion NLM called ELRDCK.NLM that can be found in NOVLIB, LIB16, in the file ELRDCK.ZIP. If this NLM is loaded, it will issue a warning and sound a beep if there is an attempt to run VREPAIR with ELRDFX loaded.

Set Directory Operation Fails To Change Drive

After a Btrieve Set Directory (17) operation is issued to change the current drive and directory, the current directory is left unchanged.

The Set Directory (17) operation is documented as having the ability to change the current drive and directory at the same time in one call. With all 5.x versions of client Btrieve and all versions of NetWare Btrieve through v6.10, Set Directory does not function as documented. If you attempt to change the drive and directory to a drive and directory other than the current one, a status 0 (Successful) is returned, but the current drive and directory will be left unchanged. The operation functions correctly if there is no attempt to change the current drive, but only the current directory.

To change the current drive and directory with the Set Directory operation, you must call the operation twice. First, issue the function only specifying the DRIVE:. Doing so will change the current drive to the drive specified on the call. Then, issue the Set Directory operation once again specifying the desired path.

Btrieve v5.x Status 109 (Transaction Too Complex)

NetWare Btrieve (NLM) v5.15 (patches applied only through #93) may return a status 18 (Disk Full) within an explicit Begin Transaction loop if the preimage file grows larger than 32 MB. When the preimage file exceeds 32MB, the Btrieve file is corrupted.

The latest set of patches for NetWare Btrieve (NLM) v5.15 introduces a new status code, status 109 (Transaction Too Complex) added by patch #95. This status code was created to compensate for applications inserting large numbers of records into their files while inside an explicit Begin Transaction loop and receiving status 18s.

The status 18 is returned because NetWare Btrieve uses a two-byte or 16-bit counter for pages in the preimage file. This counter has now been changed to allow a preimage file of 64 MB to be created before the new error 109 is returned. When the error occurs, the application may either end or abort the transaction without file corruption. Operations on other Btrieve files (not the file whose preimage file has exceeded 64 MB) can still be performed successfully.

New Btrieve Status 130 (Ran Out Of System Locks)

NetWare Btrieve (NLM) v6.x may abend or otherwise malfunction if it runs out of system locks. Beginning with patch release v6.10b (scheduled for release September '93), NetWare Btrieve will return a new status code, 130 (Ran Out of System Locks).

With any version of Btrieve before v6.10b, the abend may occur when NetWare Btrieve runs out of system locks and either the system is under heavy use, or a certain combination of start-up parameters are used. The September patch release will ensure that NetWare Btrieve monitors its supply of system locks and returns a status 130 to applications trying to perform operations requiring system locks if none are available.

NetWare Btrieve uses system locks to lock pages in v6.x files that are changed during Insert, Update and Delete operations. These locks are held for the duration of the operation or until the transaction, if any, ends or aborts.

The number of system locks Btrieve can use depends on two of its start-up parameters:

LocksPerClient ("Number of Locks" in BSETUP, "l" on the BTRIEVE.NLM command line) and MaxClients (not directly set by BSETUP, "s" on the BTRIEVE.NLM command line -not the BSPXCOM.NLM command line). The maximum number of system locks Btrieve can allocate is: #systemLocks = 65,536 - ( l * s ).

The higher the values for "s" and "l," the fewer system locks are available. This pool of system locks is shared by all users. Two factors cause heavy usage of system locks and increase the likelihood of generating a status 130:

  1. A very large transaction (e.g., thousands of records inserted),
  2. Many users performing large transactions concurrently.

Under these conditions, any user requesting an Update, Insert, or Delete may get a status 130, whether or not the user is in a transaction.

If you are in a transaction and receive a status 130, you should end or abort the transaction. You could then retry the operation; other users may have exhausted NetWare Btrieve's system locks and may have ended or aborted their transactions.

NetWare Btrieve v5.x Step Operations

With NetWare Btrieve v5.x, the Step Next and Step Previous operations can skip over records if all the bytes in the record except the first four are set to binary zero, and the first four bytes are either all binary zero or -1 (0xff). Other patterns may also be found in the first four bytes. Btrieve identifies records with these patterns as deleted records and skips them.

This situation only occurs if Btrieve 6.x or 5.x engines are used with files in 5.x format; it does not occur with NetWare Btrieve v6.x files.

Converting the NetWare Btrieve files from v5.x to v6.x format will resolve the situation. If, however, you wish to leave the files in NetWare Btrieve v5.x format, there are three possible workarounds:

Status 4 Occurs with Different Alternate Collating Sequences

If two separate files have different alternate collating sequences (ACSs) but the two sequences have the same name, status 4 may be returned when you attempt an UPDATE or DELETE operation. Btrieve will not read an alternate collating sequence into memory if one with the same name is already in memory. Thus, if a user is working with one file and then switches to work with the other file, the ACS associated with the latter file will not load, resulting in an improper sorting of the keys.

When using different ACSs for separate files, make sure that the names for each ACS are different.

Status 36 on Begin Transaction

If a workstation running a Btrieve application call Begin Transaction (19) with BREQUEST.EXE loaded, Btrieve may return a status 36 (Transaction Error). To prevent the status 36, all servers to which the workstation is attached and that are running Btrieve must have the Btrieve NLM configured for transactions.

In addition, if the workstation is configured for local and requester access, a Begin Transaction operation will also fail with a status 36 if the client (local) copy of Btrieve is not configured for transactions as well. This is true even if no local data file has been or will be accessed.

To prevent the status 36 from being returned on a workstation configured for both client and requester access, also configure the local engine for transactions. To accomplish this in the DOS environment, load BTRIEVE.EXE with /t:.In the Microsoft Windows environment, specify options= /t: in the WIN.INI file's [btrieve] paragraph.

If no local data files will be accessed, you can also resolve the situation in the DOS environment by not loading BTRIEVE.EXE or in the Microsoft Windows environment specifying local=no in the [brequestDPMI] paragraph of NOVDB.INI.

Using BASIC FIELD statements with Btrieve for Windows

FIELD statements may be used with Microsoft QuickBasic to initialize the random file buffer area for subsequent Btrieve calls. However when assigning values to these data areas with the LET assignment statement, the record's data is not inserted on the Btrieve Insert call. Instead, garbage characters are inserted.

Do not use LET or INPUT statements to assign values to FIELD variables. Instead, use the LSET or RSET operator. Once a variable name is fielded, it points to the correct place in the random file buffer. If a subsequent INPUT or LET statement with that variable name is executed, the variable's pointer is moved to string space, therefore no longer pointing to the random file buffer.

LSET left justifies the string and pads with blanks to the indicated FIELD length. RSET right justifies the string and pads with blanks to the indicated FIELD length. FIELD statements work only with string variables.

Changing Btrieve 5.10a Interrupt (Btrieve for DOS v5.10a)

When you attempt to change the 7b interrupt which is used by Btrieve, you will discover more than one occurrence of it. For this reason, you must be careful which address you change: the first address should not be edited, while the third address should. The "25h-7bh" found in the first address are just bytes in the offset to another call, and only coincidentally contain these values.

Under Btrieve for DOS v5.10x, change the code as shown in Figure 15.

FIGURE 15: Changing Btrieve v5.10a interrupt ren btrieve.exe btrieve debug btrieve -r ;get the value of the cx register. -s 0L[cx] 7b 25 ;search for "set interrupt" where [cx] is value ;of cx register obtained above. ; ;the search returns THREE addresses ssss:zzzz ;DO NOT EDIT THE FIRST ADDRESS !!! ssss:xxxx ; ssss:yyyy ; ; -e ssss:xxxx ;edit first address to change interrupt ssss:xxxx 7b. ;address one is returned showing value of 7b. ;Prompt is waiting for the new interrupt value. __ ;Enter the value of the new interrupt. -e ssss:yyyy ;edit second address to change interrupt ssss:yyyy 7b. ;address two is returned showing value of 7b. ;Prompt is waiting for the new interrupt value. __ ;Enter the value of the new interrupt. -s 0L[cx] 7b 35 ;search for "check interrupt" where [cx] is value ;of cx register obtained above. ssss:xxxx ;the search returns ONE address -e ssss:xxxx ;edit that address to change interrupt ssss:xxxx 7b. ;that address is returned showing value of 7b. ;Prompt is waiting for the new interrupt value. __ ;Enter the value of the new interrupt. -w ;write changes to disk -q ;quit debug ren btrieve btrieve.exe END of FIGURE 15

Microsoft QuickBasic & Btrieve Status 76

Btrieve applications compiled with Microsoft QuickBasic may return a BASIC run-time error 76 (Path Not Found) when run on peer-to-peer networks. The error occurs when executing the OPEN "NUL" statement in applications that use fielded variables rather than type structures.

To resolve this error, change each OPEN "NUL" statement to:

OPEN "\DEV\NUL".

By default, Microsoft QuickBasic appends path names to files opened with the OPEN statement. The \DEV\ added to the OPEN statement prevents Microsoft QuickBasic from assigning a file path to the device and enables the statement to succeed.

Btrieve Overwrites Key Buffer with Status 22

Btrieve will overwrite the Key Buffer parameter on a Get Equal (5) operation if a status 22 (Data Buffer Length Too Short) is returned. NetWare Btrieve (NLM) v6.x and the Btrieve v5.x client versions overwrite the Key Buffer parameter with extraneous characters on a Get Equal (5) operation if a status 22 (Data Buffer Length Too Short) is returned from the call. This situation occurs only if the data buffer length specified is less than the offset and length of the key specified in the Key Number parameter.

This situation occurs because the return key value is extracted from the data buffer itself. An incomplete Data Buffer results in an incomplete (thus invalid) key value.

Status 22 is an informative status code indicating that there is more data in the record than Btrieve was able to return. When using variable-length records, many developers intentionally set the Data Buffer Length parameter to a number that is less than needed to return the entire record. Doing so can improve performance by preventing a variable- page read when only the fixed-length data is needed. This is an acceptable method of data retrieval. The Key Buffer overwrite problem described above only occurs if the Data Buffer Length parameter specified is shorter than the fixed- length portion of the record, and specifically the offset of the key specified in the Key Number parameter.

Loading Brequest from Login Scripts

When loading BREQUEST.EXE from a NetWare login script, the TSR fragments memory, so it appears to take 200K of space. This memory loss is attributed to the fact that the LOGIN program is still in memory when the TSR is loaded. It gets trapped between whatever was in memory prior to logging in (most likely the network shell) and the newly loaded TSR.

To avoid this situation, do not load TSRs from login scripts. If you need to load any TSRs at login time, use the "EXIT" statement in a login script to call a DOS batch file. Batch files can load the TSRs without this memory penalty.

Ensuring Btrieve Transaction Recovery (Btrieve for DOS v5.10a)

The documentation for Btrieve for DOS v5.10a states that, when using Btrieve in a networked environment, all users who start Btrieve with a "/T" option should specify the same physical location for the transaction control file. This rule ensures that, when a data file is shared by two workstations, both of the stations will be able to recover from a server failure during an End Transaction (20) operation, regardless of which station is recovered first.

This rule should be applied, but it is not foolproof. The full logical path of the data files used in a transaction are stored in the transaction control file. If the first station to start Btrieve after a server failure does not have the same logical mappings to the files as the station that was processing an End Transaction operation during server failure, Btrieve will not be able to access the files described in the transaction file and will report the error "Unable to access Btrieve file for transaction recovery."

To insure transaction recovery after a server failure, all stations should share the same transaction file (/T), and should also access the data files with the same logical mappings.

IBM LAN Server Reports Sharing Violation with Btrieve

IBM LAN Server reports a "Sharing Violation" when an application issues a Close (1) operation on a Btrieve file if at least two stations have a data file open and have both modified the data file.

The error occurs when Btrieve for DOS performs its Close test to determine if it is the last instance accessing the data file. During the Close operation, Btrieve tries to open the preimage file in exclusive mode. If the Open operation succeeds, then Btrieve knows that this is the last handle to the data file and can erase the preimage file. Unlike DOS, LAN Server interprets this test as a critical error.

To prevent this "Sharing Violation" error from occurring, load Btrieve with a "/O." This load parameter tells Btrieve to override the critical error handler so that Btrieve handles critical errors instead of the operating system.

Btrieve Clients & SHARE.EXE

SHARE.EXE needs to be loaded on Btrieve for DOS and Btrieve for Windows client workstations under the following conditions:

DOS, by default (and without the NetWare shell), provides no locks at all; that is, INT 21H, function 5CH, is a "NOP." To support locking on local disks, DOS provides SHARE.EXE. In order for Btrieve to be able to lock records on a local disk, SHARE.EXE must be loaded.

SHARE, by default, allows up to 20 concurrent locks. To increase locks, use the SHARE "L" command line parameter. The "F" parameter may have to be used to make SHARE allocate more work space if many files are locked, or if the files are in "deep" subdirectories, (for example, c:\path1\path2...\path6\FILE.EXT).

Btrieve NLM Allows Duplicate Records

Btrieve NLM v6.10b will insert duplicate records into a Btrieve v5.x format file under the following circumstances:

In this case, the successful record as well as a data page with the record that failed is written to the file. If a key path is always used to retrieve data, then the "bad record" (with the duplicate value) will never be seen. However, if STEP operations are used, Btrieve will return the duplicate records that were written to the data pages. Thus, a BUTIL -RECOVER followed by a BUTIL -LOAD will produce duplicate errors.

To avoid this situation, rebuild files in Btrieve v6.x format or use a page size that can hold more than one record.

NetWare Btrieve in Primary I/O Engine

With Btrieve v6.10b, BROUTER and BTRVSTUB.NLM are provided to allow NetWare SFTIII users to run Btrieve from the I/O engine. These components do not work if run from the Primary I/O engine. However, they do work if they are run in the Secondary I/O engine. Only run Brouter/Btrvstub in the Secondary I/O engine.

When Does Btrieve Delete Delta Files?

With Btrieve NLM 6.10b, Delta files are deleted as soon as the End Continuous Operations command is executed. Upon executing this operation, Btrieve writes the updates from the Delta files to the corresponding Btrieve files and deletes the Delta files.

Versions of Btrieve before v6.10b delete Delta files created during continuous operations after the last user closes the corresponding Btrieve files. When End Continuous Operations is executed, updates are made to the Btrieve files and the size of the Delta files is changed to zero.However, the Delta files are not deleted until the last user closes the actual Btrieve files.

Ascending Order & Autoincrement Keys

Btrieve returns a status 5 (Duplicate Key Value) when you attempt to insert a record with an autoincrement field value of zero. Btrieve returns this status code when the autoincrement key has the descending attribute set. Then, when the insert is executed, Btrieve finds the highest value for the autoincrement key equal to "1" and increments it by one to get "2." Since the value "2" already exists in the file, Btrieve returns the duplicate key value error.

Autoincrement keys should always be defined as Ascending.

Status 95 & NetWare SFT III

When the primary NetWare SFT III server is disabled and resynchronization is taking place, Btrieve may return a status 95 (Session not valid) while NetWare SQL may return status 2103 (NetWare SQL is not active on the requested server).

To prevent these status messages, increase the "IPX Retry Count" parameter in NET.CFG to a value of 40 or more. Raising this parameter prevents workstations from timing out and NetWare from terminating their IPX connections. In addition, always use the latest VLM drivers, (see "Current Shell and Requester Versions).

Null Key Path & Status 44

With pre-6.x versions of Btrieve, the record manager returns a status 82 (Lost Postioning) when you attempt to perform a Get Direct (23) operation on a key with a null value in the record at the provided position. NetWare Btrieve v6.10b and v6.10c may return a status 44 (Null Key Path), instead.

Status 44 can occur when you define the key attribute to be manual or null ("all-segment" and "any-segment"). If your existing Btrieve application checks for status 82, consider rewriting your Btrieve application to check for status 44, as well.

New Btrieve NLM Configuration Option for 6.10x

NetWare Btrieve v6.10x includes a new configuration option: "Perform Index Balancing." Index balancing results in Btrieve files that have more entries on individual key pages, increasing access time. However, it may decrease performance on Insert, Update and Delete operations due to the extra work required to balance the indexes.

The NetWare Btrieve v6.10 Setup Utility (BSETUP.NLM) allows you to set this option if you want all newly created files to have balanced indexes.

However, the Btrieve configuration option of the NetWare SQL Setup Utility (NDBSETUP.NLM) does not include this new option. NetWare SQL should use BSETUP to configure Btrieve rather than NDBSETUP to enable the Index Balancing option.

Configuring Btrieve for Windows

Any configurations or initialization parameters for WBTRCALL.DLL v5.10 and WBTRLOCL.DLL must be set in WIN.INI. Although NOVDB.INI file contains a section for Btrieve, this configuration is never used by Btrieve for Windows.

Using Visual Basic Controls with Btrieve

When using data-aware controls in a Visual Basic application with Btrieve for Windows, Visual Basic uses a file called BTRV110.DLL. A section of the VB.INI file tells Visual Basic where to find this file, for example:

Using Visual Basic Controls with Btrieve (Btrieve for Windows v5.10)

When using data-aware controls in a Visual Basic application with Btrieve for Windows, Visual Basic uses a file called BTRV110.DLL. A section of the VB.INI file tells Visual Basic where to find this file, for example:

[Installable ISAMs]
btrieve=c:\windows\system\btrv110.dll

This section in the VB.INI file is only used when running the application in the Visual Basic development environment. When compiling the application into an executable file and running it outside the Visual Basic environment, the following error may be returned:

Couldn't find installable ISAM

When running the executable, an .INI file with the same name as the executable must exist in the Windows directory, and it must contain a section pointing to the BTRV110.DLL, just like the entry in VB.INI. For example, if the application is called BTRDATA.EXE, a BTRDATA.INI file must exist in the Windows directory with the appropriate [Installable ISAMs] section.

Data Buffer Length & Get Next Extended

The documentation for NetWare Btrieve v6.x states that the length of the Data Buffer should be set to:

max(sizeof(in-going structure),sizeof(out-going structure))

This description refers to the Data Buffer Length parameter sent on the Btrieve call, not the first two bytes of the descriptor in the Data Buffer.

Set the first two bytes of the descriptor in the Data Buffer to the exact length of the in-going structure. Set the Data Buffer Length parameter to the larger of the in-going structure length and the out-going structure length.

UC Option on Btrieve Extended Operations

Btrieve v5.1x and above now support the UC option on the Get Next Extended (36) and Get Previous Extended (37) operations. This option tells Btrieve to begin searching for records that match the provided filter (if defined) with the current record instead of the Next/Previous record. The application still must establish positioning with a Get First (12), Get Equal (5) or some other operation before using this option in the extended call.

UC functionality is automatically provided in the 5.15 and 6.x versions of the NetWare Btrieve NLM. All other current versions of Btrieve must be patched in order for the UC option to be functional, including:

Patches for these versions of Btrieve are available in Novell's NOVLIB forum on CompuServe (Library 7, BTR515.EXE or BTR510.EXE depending on the version of Btrieve being used). You can also obtain these patch files from Novell Developer Support (see "Contacting Novell" at the end of this issue).

The UC functionality is also available with the Step Next Extended (38) and Step Previous Extended (39) operations, but only with the Btrieve NLM (v5.15 and all 6.x versions). The UC option can not be used on the Extended Step operations when using the client versions of Btrieve or the Btrieve VAP. Any attempt to do so will return a successful status code, but no records will be returned in the data buffer.

NetWare OS/2 Requester Produces Status 95

NETX must be loaded and the LOGIN process must be executed in every Private DOS session. Even though the MAP command may display drive mappings, those resources actually are not available to the DOS session. Use the LOGIN command to allocate resources to the DOS box. Otherwise, a Btrieve status 95 (Session No Longer Valid) may be returned if you use a Private DOS box with OS/2 v2.1 and the NetWare OS/2 requester v2.01.

When using Private DOS sessions with the 2.01 version of the NetWare OS/2 requester and the Btrieve OS/2 requester v6.1x, always verify that NETX is loaded and that the LOGIN procedure described above has been followed.

Erroneous Status 82s and 2s (Btrieve for DOS 5.10a)

When a user attempts to read a Btrieve file that is being modified, the file may actually be busy. This situation may result in the read operation receiving incomplete data, causing an erroneous status 82 (Lost Position) or status 2 (I/O Error).

Currently, there is no solution for the client Btrieve engines, except to retry the operation. The status messages are in error and disappear when the write operation completes. The status messages result from a timing window problem.

No erroneous status is returned when using transactions. Also, this situation does not exist with the Btrieve NLM or VAP, since only one engine handles the writes and reads for all users.

Establishing Multiple Btrieve Sessions Triggers Status 91

Versions of NetWare Btrieve prior to v6.10c may return a status 91 (Server Error) if many users attempt to establish a session simultaneously.

NetWare Btrieve returns this status because BSPXCOM.NLM has posted only one Listen-For-Connection Event Control Block (ECB). BSPXCOM.NLM v6.10b, which is included with NetWare Btrieve v6.10c, now posts five Listen-For-Connection ECBs for establishing sessions with workstations.

NetWare Btrieve v6.10c is available for downloading from Novell's NOVLIB forum on CompuServe (Library 7, BTR61.EXE), or from Novell Developer Support.

Synchronize logging and continuous ops

Enhancement request: customers can't use logging and continuous ops together without having to close files in order to guarantee the log file is cleared at the right time. *Van* This is not possible as a patch because logging happens in the foreground and cannot be synchronized with the background process. It will be fixed in the 6.2 release when logging is re-written. As you can see from above, support has turned in this problem to development. Some time in the future it will be addressed. If you would like to inquire about this issue please feel free to fax the product manager at 512-794-1887.

Copyright © Madis Kaal 2000-