Use ttBulkCp with Restrict Mode

When you run the ttBulkCp (or ttBulkCpCS) utility with the -restrict option, the command-line options listed in the table below prevents you from overwriting existing files.

The system displays an error message if you try to overwrite an existing file. If the file does not exist, then ttBulkCp creates it.

Command-line Option Reason to Block Error Message
-o <datafile> Overwrites an existing data file. cannot overwrite the existing file dataFile in the restrict mode
-e <errfile> Overwrites an existing error file. cannot overwrite the existing error file errorFile in the restrict mode

If the command does not include the -o or -e option, no output file is present, and there is nothing to restrict. The -restrict option prevents overwriting only if there is an existing data file or an error file.

This example shows how the -restrict option prevents ttBulkCp from overwriting an existing file called sales.dat when exporting the contents of the table mytbl to that file:
$ ttBulkCp -o -restrict mystore mytbl sales.dat
ttBulkCp: cannot overwrite existing file sales.dat in restrict mode.0/0 rows copied.
This example shows how the -restrict option prevents ttBulkCp from importing data if the specified error file errors.log already exists:
$ ttBulkCp -i -restrict -e errors.log mystore mytbl sales.dat
ttBulkCp: cannot overwrite existing error file errors.log in restrict mode.