CONVERT_DAT_FILE¶

Applies to: ORAFlex SQLFlex MYSQLFlex PGFlex DB2Flex

This command is the programmatic equivalent to the Flex2SQL Migration Tool. With this command, a SQL table can be created from a .DAT table. This combines the COPY_DATA and CREATE_TABLE_FROM_DAT_FILE, creating the table structure and copying all the data into the new table with one command. The table being converted cannot be opened and so a manual login is needed. Note that to specify the database to copy the table to, use SET_DATABASE_NAME. Below is a list of the optional restructure options to use when creating the table.

The possible options are:

  • DF_STRUCTEND_OPT_FORCE_INVK - Deprecated - forces inverse keys to be created.

  • DF_STRUCTEND_OPT_OLD_INVK_NAME - Deprecated -

  • DF_STRUCTEND_OPT_FORCE_NOT_NULL - forces all fields to be created as NOT NULL.

  • DF_STRUCTEND_OPT_CREATE_ROWID_TABLE - A rowId table does not use RECNUM to uniquely identify a record, but instead relies on you specifying one or more fields that when combined create a unique record identity.

Syntax

CONVERT_DAT_FILE {FileNumber} [{options} {table}]

Parameter

Description

FileNumber

Number of the file

options

DF_STRUCTEND_OPT_FORCE_INVK DF_STRUCTEND_OPT_OLD_INVK_NAME DF_STRUCTEND_OPT_FORCE_NOT_NULL DF_STRUCTEND_OPT_CREATE_ROWID_TABLE (optional)

table

Name of table to use instead of physical name (optional)

Example

Login "localhost" "user" "pass123" "sql_drv"
open Customer
CONVERT_DAT_FILE Customer.File_Number DF_STRUCTEND_OPT_FORCE_NOT_NULL "Customer"
close customer

Example with mulitple options

Login "localhost" "user" "pass123" "sql_drv"
open Customer
CONVERT_DAT_FILE Customer.File_Number (DF_STRUCTEND_OPT_FORCE_NOT_NULL+DF_STRUCTEND_OPT_CREATE_ROWID_TABLE) "Customer"
close customer