INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Error 26 - Number of Keys

Error 26 - Number of Keys

(OP)
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

RE: Error 26 - Number of Keys

(OP)
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

RE: Error 26 - Number of Keys

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.
http://www.mirtheil.com

RE: Error 26 - Number of Keys

(OP)
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

RE: Error 26 - Number of Keys

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.
http://www.mirtheil.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close