Most database management systems (DBMS) as well as many reporting
tools, support TDFs in some fashion. Many can import and export
data in TDFs making TDFs an effective tool for transporting
data between databases and applications.
- All data stored in a TDF is stored in text format.
- Binary data is stored in its character form.
- Trailing white space is stripped from the textual data,
providing a fair amount of compression in many situations.
- Data containing column or record delimiters is quoted.
- Column and record delimiters are added to the stored data.
Although Tab-Delimited Files can be used as permanent storage
for data, it is not recommended. The compression achieved
through TDFs applies only to textual data and only if that
data has trailing white space The compression achieved in
codified textual data with little or no white space, is minimal
or non-existent and in some cases can actually increase the
size of the record when stored in a TDF. Binary data is converted
to its textual form, thereby significantly increasing its
size (see below).
Creating a TDF
Omnidex supports read-only access to Tab-Delimited Files
and provides the ability to create TDFs using an EXPORT
statement. TDFs have a .tdf file extension.
Omnidex can create an Offset Index file (OFX), which correlates
file offsets with record numbers, to support indexed access
to TDFs. This file is created by passing the OFX option in
the WITH clause of the EXPORT
command. OFX files have a .ofx file extension.
To create a TDF file, issue an EXPORT
command using one or more (comma separated) of the options
listed below. The same options should be used in the table
definition when declaring a TDF table in the Omnidex
Environment file. Use the LOAD command to load (or reload)
an OFX for a TDF file.
EXPORT Options for Creating TDFs
TDF -- REQUIRED. This options
informs Omnidex that the type of export file to create is
a TDF.
COLUMN="string"
-- Column Delimiter. This is the character that is to be used
to separate columns in a record. It can be up to two characters.
Use C language tokens for special characters (e.g. \t for
tab, etc...). If omitted, the default is \t.
RECORD="string"
-- Record Delimiter. This is the character that is to be used
to separate records. It can be up to two characters. Use C
language tokens for special characters (e.g \r for carriage
return, \n for linefeed, etc...). If omitted, the default
is \n.
QUOTES -- Instructs OA to
support quotes in a record. If omitted, quotes are not supported.
Note that this option does not cause OA to create TDF files
with quotes. It is strictly to support quotes in existing
files.
ESCAPE=character -- Defines
an escape character used to escape delimiters and quotes.
SKIP=n -- Instructs OA to
skip n bytes at the beginning of each row.
OFX -- Creates an OFX file
when a TDF is created. If omitted, you must use the command
'load ofx for tdf tdfname'.
FIRST_ROW=n -- Begin processing
at row n, ignore all previous rows
MAX_ROWS=n -- Stop processing
after n rows, ignore all subsequent rows.
top
Example
The following example of creates a TDF file and loads an
OFX in OdxSQL, and declaring a TDF in an environment file:
> export select * from prospects to pro with
tdf, column='\t', record='\r\n'
64 rows exported
> load ofx for tdf pro
Loading OFX ...
64 entries loaded: 0.000 CPU sec. 0.000 Elapsed
sec.
Loading complete.
Environment File
table "PROSPECTS"
physical "pro"
type tdf
options "column='\t' record='\r\n'"
primary "ACCT"
top
|