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:

Leave a Reply