Write Your Own Migration Routines Using the CONVERT_DAT_FILE Macro

Mertech provides a macro, CONVERT_DAT_FILE that can be called from a DataFlex program using the Mertech.inc file. This macro will migrate a DataFlex file to the target backend, creating table and index structures and copying data using the default settings of GUI database migration tool.

Using the CONVERT_DAT_FILE, you can write your own custom migration routines to handle migrations at remote sites.

Code Snippet

Use Mertech.inc

if (sDataBase <> “NULL”) Begin
SQL_USE_DATABASE     sDataBase
SET_DATABASE_NAME to sDataBase
End

If (Err) Begin
Showln “Login Error !”
Inkey Pageend
End

Get_Attribute DF_FILE_ROOT_NAME of iFileNumber to sPhysicalFileName

MERTECH_WARNING_MESSAGE DISABLED

Showln “File: ” sPhysicalFileName
Showln
Showln “Converting DF File …”

CONVERT_DAT_FILE iFileNumber

Open iFileNumber Mode DF_EXCLUSIVE

Set_Attribute DF_FILE_ROOT_NAME of iFileNumber to ((UpperCase(sDriver)) + “:” + (Trim(sPhysicalFileName)))

…….

Tags:

One Response to “Write Your Own Migration Routines Using the CONVERT_DAT_FILE Macro”

  1. [...] DataFlex databases to SQL without any attendants. Cl2SQL can be used along with the CONVER_DAT (see http://blog.flex2sql.com/index.php/2009/02/write-your-own-migration-routines-using-the-convert_dat_f…) command to develop unattended migration [...]

Leave a Reply