Migrating Files when DDFs are not Available

MdsMigrateFile is a command-line tool that is provided as a last-resort proof of concept approach to see that an application can run against SQL. MdsMigrateFile is useful in a situation where no schema definition is available for a Btrieve file. MdsMigrateFile runs a B_STAT command on the file to determine the file statistics and index structure. MdsMigrateFile then issues a B_CREATE against the SQL backend, defining fields based on the reported index structure. Once the table is created, MdsMigrateFile copies the records. MdsMigrateFile produces tables that work with the Mertech drivers to make the application functional, but typically the data is not usable in SQL by other applications or tools. MdsMigrateFile is installed in the <Program Files>\Mertech Data Systems\DB Drivers\Btrieve\bin directory.

MdsMigrateFile Command-line Tool

Command-line syntax

Run MdsMigrateFile by typing the following at a command prompt:

MdsMigrateFile.exe BtrieveFileName [configuration parameters]

NOTE: The BtrieveFileName can include wildcards.

Configuration Parameter

Description

/owner <ownername>

Owner name associated with the Btrieve file. Multiple /owner <ownername>parameters can be provided and MdsMigrateFile will cycle through the names attempting to find the correct one.

/server <server name>

Destination SQL server and optional port number where the server is listening for communication. Always use the same SQL server version as the end-user. For instance, migrating to MS2008 utilizes different data types than MS2005.

/database <dbname>

Destination database.

/schema <schema>

Destination database schema.

/user <username>

User name for server login (empty for trusted connection).

/password <password>

Password for server login.

/dll <Mertech migration dll>

The path and filename of the Mertech migration dll (sql_btr.dll, ora_btr.dll, or pgs_btr.dll) used to access the SQL backend. If the full path is not specified, the dll is loaded from the system PATH. Defaults to sql_btr.dll if no dll is provided.

/force-int-usage

When this token is included, MdsMigrateFile uses the field definitions in the INT file (rather than those returned by B_STAT) to create the SQL table. If the BtrieveFileName is Billing.MKD, the expected INT file is Billing_MKD.INT.

/validate-data

When this token is included, the migrated data is read back and compared to the original file.

/trace <trace filename>

Path and filename for the trace output.

/level <trace level>

Level of tracing (0, 1, 2, 3, 4, 5, or 6). Trace level 2 is usually sufficient for user debugging.

For example:

"C:\Program Files (x86)\Mertech Data Systems\DB Drivers\Btrieve\bin\MdsMigrateFile.exe" BILLING.MKD /server DEV-PC\SQLEXPRESS /database TestDB /trace mytrace /level 2

NOTE: If the server, database, and/or login credentials are not provided, the mds.ini file, registry settings, or Login dialog box provide these details.

NOTE: During the migration, INT files are created in the same location as the Btrieve file unless they are redirected to another folder by the mds.ini file.

Comparison to conversion using the GUI Migration Utility

Below are two SQL table structures for the Pervasive Demodata file Billing.MKD. The structure on the left was created using the GUI Migration Tool (MdsMigrateTable can also be used). The structure on the right was created using MdsMigrateFile.

GUI Migration Utility

../../_images/image41.png

MdsMigrateFile

../../_images/image42.png

Notice the difference in the columns. When the GUI Migration Utility is used, field names, field sizes, and data types match the information provided in the DDFs. When MdsMigrateFile is used, columns are strictly based on the index structure returned by the B_STAT command. Fields that are not indexed are combined into FILLER fields.

Below are the results of a query to retrieve records from the Billing file that was created using the GUI Migration Utility.

../../_images/image43.png

Below are the results of a query to retrieve records from the Billing_MKD file that was created using MdsMigrateFile.

../../_images/image44.png

Improving the conversion process

MdsMigrateFile is not the recommended method for migrating files.

If you know the file structure, you can greatly improve the conversion process by:

  • Creating the DDFs and then using the BTR2SQL GUI Migration Utility or MdsMigrateTable to migrate the file.

or

  • Copying an INT file for a similar file and renaming it to match your filename (Billing_MKD.INT in this example). Then, running MdsMigrateTable using the /force-int-usage token. For example:

    "C:\Program Files (x86)\Mertech Data Systems\DB Drivers\Btrieve\bin\MdsMigrateFile.exe" BILLING.MKD /server DEV-PC\SQLEXPRESS /database TestDB /force-int-usage
    

NOTE: Contact Mertech Technical Support for assistance with this conversion process.