Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 26 - Number of Keys

Status
Not open for further replies.

trims30

Programmer
Dec 17, 2000
22
US
Help! - Using Btrieve 6.15 and Getting Error 26 on executing Btrieve function 14 "Create"

I use the same code for all of my files and everyone works except the one file with a large number of indexes and segments.

File causing trouble has 6 indexes with a total of 31 segments.

My data structures are defined as follows...

Any Ideas as to what's hapening?
Something unique to windows XP - SP2 or VB6 Perhaps?
This code did work last year and only thing I know of that's changed is Windows XP-SP2.

Any help is appreciated.

Thanks,

Lee

'Index Segment Structure
Type BTSegment
iPosition As Integer
iSize As Integer
iFlags As Integer
slCount As String * 4
sType As String * 1
sNullValue As String * 1
sReserved As String * 4
End Type

'Maximum number of Index Segments per file
Global Const MAXSEGMENTS = 48

'File Status Structure
Type BtStatus
iRecSize As Integer
iPageSize As Integer
iIndexCount As Integer
slRecordCount As String * 4
iFileFlags As Integer
sReserved As String * 2
iPreAlloc As Integer
Seg(MAXSEGMENTS) As BTSegment
End Type

Global FileStats As BtStatus

 
More Info - I do have one file that has Seven (7) indexes and a total of 33 segments that I am able to create using same code.

On the offending file, if I drop the last two indexes I am able to create file.

Error does not appear to be in my data structures.

Lee
 
What's the page size that's being specified? Also, where's the rest of the Create code? The code you posted shows the structure but not how you're setting the values or actually calling Btrieve.
One more question, have you tried with something newer than Btrieve 6.15?

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
Found problem to be Page Size. Didn't realize that with smaller page size we were only allowed 24 index segments. Increased page size to 2048 and now I can have 54 index segments and create works correctly.

Thanks for the help.

Lee
 
Page size has always limited the numer of key segments. From the V8 docs:
26: The number of keys specified is invalid
The number of keys specified for the page size is invalid. The number of key segments must be within the following limits:

Table 1-6 Maximum Number of Key Segments Page Size 512 1024 1536 2048 2560 3072 3584 4096
Maximum Number Key Segments 8 23 24 54 54 54 54 119


If the MicroKernel is configured to create files in v5.x format, the maximum number of key segments is 8 for files using 512 byte page sizes; the maximum number of key segments for all other v5.x files is 24.

For a key-only file, this status code is also returned if the number of keys specified is not one, or the available linked keys is not zero (only one key is allowed for a key-only file.)



Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top