Lesson 7 – Variable Length Record Mismatch
Scenario
In this lesson, you have a Btrieve file with a different variable length record than the variable length record set in the table definition.
Goals
The goal is to open the file with DDF Builder and see if DDF Builder makes any updates to the definitions. You will inspect any changes that DDF Builder implements and discuss changes needed to make to fix the variable length record mismatch.
*Note: Currently DDF Builder does not recommend solutions to fix the variable length record mismatch.
What You Need to Know
For this lesson, use the file named VARTABLE.MKD. This file resides in a folder named Tutorial2. Assuming you installed using the default installation locations, this folder is located at:
<Application Data>\DDFBUILDER\TUTORIALS\TUTORIAL2
This folder is part of the Tutorial2 database.
*Note: You must have a Data Source Name (DSN) that points to this database in order to access the data in this tutorial. If you have not yet created this DSN, refer to Create Data Source Names (DSN).
Open the Btrieve File
You should have DDF Builder already running from the last lesson. If not, begin by starting DDF Builder.
1
2
3
4
The Table Definition Editor opens and displays the following message:
This message tells you that DDF Builder has analyzed your existing table definitions and found problems with those definitions. As a result of this, DDF Builder had to make some modifications to open and display the existing table definitions.
5
Click OK to clear the message and display the table definition.
*Tip: For a complete list of possible definition errors, refer to Table Definition Errors.
Look for Inconsistencies
Begin by looking at the DDF Builder interface to review the differences between the original definition and the modifications that DDF Builder made, as well as reviewing the errors reported.
The Table Definition Editor’s grid data view shows the modified table definition.
*Note: DDF Builder changes are not automatically saved. Any modifications made by DDF Builder must be saved.
DDF Builder gives you visual indications as to the columns that need attention by adding the unknown column indicator to the fields that are altered or added. In addition, the variable column indicator is added to columns that contain an unknown variable.
*Tip: For more information on the attributes in the grid data view, refer to Field Attributes in Grid Data View.
A list of the issues DDF Builder detected and changed display in the Definition Errors view.
The original table definition, before DDF Builder made any changes, is available from the Original Definition view.
Understanding the Errors
The Definition Errors view tells the following:
The Definition Errors lists two problems:
The DDFBLDR-12 error results from a variable length field that does not occur as the last column in the table definition. Because the file contained a variable length field in a place other than the last column, DDF Builder changed the data type of this field to Unknown.
*Tip: Lesson 3 – Invalid Data Types and Sizes provides a step-by-step tutorial specifically dealing with the situation where the column data type is invalid for the column size.
To fix the variable length field issue, define the unknown field with an appropriate data type, as discussed in the next section.
The last error reported is an index that DDF Builder found in the existing table definition that does not have a corresponding key in the Btrieve file. In the course of this lesson, this error is not addressed, only the variable length field. For information on resolving errors pertaining to indexes, see Lesson 6 – Index Inconsistencies.
Define the Unknown Field
Define the unknown field in the grid data view of the Table Definition Editor.
1
2
Select String from the Btrieve Type drop-down list.
*Note: Editing columns in a variable portion of a table is not recommended if your definition contains BLOB or CLOB data types.
Save the Table Definition
You have defined the Unknown field and fixed all of the issues, now save the table definition.
Before you save your work, take one final look at the table definition.
The table definition shows no undefined fields remaining and every byte is accounted for. You can now save your table definition.
1
From the menu bar, click FileSave to save the table definition.
Conclusion
Congratulations, you have successfully saved your table definition and corrected your variable length field. This lesson introduced you to how DDF Builder deals with variable length fields that are not at the end of the record. It also showed you how to define the field and create a valid table definition for the file.