Lesson 8 – Record Length Mismatch
Scenario
In this lesson, you have a Btrieve file with a different record length than the record length 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 that are needed to fix the record length mismatch.
*Tip: DDF Builder recommends solutions to fix the record length mismatch and allows you to save those changes.
What You Need to Know
For this lesson, use the file named rec_length.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 the 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.
*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 one problem:
The error reported by DDF Builder indicates a record length mismatch.
*Tip: You can see the original record length for the Btrieve file by clicking the Statistics tab.
This means that the table definition did not contain fields to account for all the bytes in the record. DDF Builder created a new column with the unknown data type to account for these bytes.
Defining and accounting for all of the bytes creates a table definition that accurately matches the Btrieve file. Look at the bytes at the bottom of the grid data view in the row named unnamed_6.
Now define the unknown field so that the record lengths match between the file and the table definition.
Define the Field
Next, define the unknown field in the grid data view of the Table Definition Editor.
1
2
3
Check the Null check box.
4
Change the Size to reflect 50 bytes.
5
In the Btrieve Type column, select String from the drop-down list.
6
Select Case check box.
Your table definition should now look similar to the following:
7
8
9
In the Btrieve Type column select Money from the drop-down list.
10
Leave the Precision at 10; the Scale should remain at 2.
Your table definition should now look similar to the following:
Now that all the unknown fields are defined and every byte is accounted for, save the table definition.
Save the Definition
Save the table definition so that you save your work and apply the changes.
1
From the menu bar, click FileSave to save the table definition.
Conclusion
Congratulations, you have successfully saved your table definition and corrected the record length mismatch. This lesson introduced you to how DDF Builder deals with differing record lengths. It also showed you how to define the field, split the column by resizing and create a valid table definition for the file.