Creating Variable Length Records from Flat Files

When you use DAL database functions, such as DBOpen and DBClose, to write flat files, the record length is usually fixed and data is padded with spaces to equal the maximum size of the record. You can, however, specify that no trailing spaces are to be output.

You would typically use this capability to output flat files used to create index information you will import into a 3rd-party application, such as FileNET.

To specify no trailing spaces, include the following syntax in your DAL script:

DBOPEN(FN_LogFile,"ASCII",".\deflib\filenet.dfd", "READ&WRITE&TRUNCATE&CREATE_IF_NEW&CLIPSPACES");

CLIPSPACES tells the system to remove any trailing spaces.

Keep in mind that CLIPSPACES only affects flat files. For the rest of the databases, each column is set separately and no trailing space exists on the whole record.

Example

Here is an example:

Procedure

Result

Explanation

DBOpen ("APPIDX", "ODBC", ,"READ")

1 or 0

Will open the table named APPIDX for reading and associate it with the ODBC handler. Table information will be queried from the database driver, if possible.

DBOPEN("MYTABLE","ODBC","D:\deflib\mytable.dfd",
"READ&WRITE&TRUNCATE")

 

This DAL statement removes all rows from the table named MYTABLE.

See also