The STARTDATA Directive

Top  Previous  Next

For those who want it, the data records for an import of delimited records can be optionally embedded into the control file.  The directive STARTDATA following the SQL statement tells dbFile to read all content from the beginning of the next line to the end-of-file marker as input.

Limitations

Although embedding the input data in the control file is supported, it is not recommended:  import files are usually outputs from other sources of data and there are strong reasons to keep data and processing directives cleanly separated.  Moreover, it restricts your control file to a one-off usage, defeating the objective of storing a repeatable process conveniently in a file.

If you are determined to use STARTDATA, keep in mind that there are limitations to this usage:

It is invalid for data in Excel format data since the control file itself is not compatible with Excel
It does not support input of fixed record format

On Windows, bear in mind that conditions exist where the operating system does not correctly write an end-of-file marker if the last line of data is not completed with a hard "paragraph break" (carriage return + linefeed).  It is a good precaution therefore to make a point of hitting the Enter key at the end of your block of data, before saving the file.

Usage in a Raw Command

On POSIX, it is possible to invoke dbFile and import data without using a control file.  It is possible (albeit not particularly practicable!) to append a STARTDATA block to a raw dbFile command using regular shell syntax.  For more information, see the examples in the topic Using the Command Line Without a Control File.