RUN - Basic Teradata Query

Basic Teradata Query Reference

Basic Teradata Query
Release Number
October 2018
English (United States)
Last Update
Product Category
Teradata Tools and Utilities


Processes the SQL requests and BTEQ commands from the specified run file instead of stdin or a run file currently being processed.


where the following is true:

The name of the file that contains the BTEQ commands and SQL requests on workstation-attached systems.

If the name of the file includes a comma, semicolon, or space character, enclose the entire file name in either single or double quotation marks.

Additionally, any time text follows a file name, that file name must be enclosed in quotation marks.

File names are case sensitive on systems running on a UNIX system, and case-insensitive on systems running under Windows or TSO.

For mainframe-attached systems, this is the name of the z/OS JCL DD statement that defines the file from which BTEQ commands are read. An ALLOCATE statement must be used for TSO.

When used in a RUN file, BTEQ stops reading from the RUN file and switches to reading commands and requests from the standard input stream instead. The RESET keyword can also be used as an alias for QUIT.
SKIP = n
The number of lines skipped from the beginning of a data set or file before reading BTEQ commands. The valid range of numbers is 0 to 2147483647.

Usage Notes

BTEQ supports all QSAM-compatible record formats. The maximum acceptable line length is 254 characters.

If specifying a RUN command within a run file, BTEQ switches and begins reading from the new file; BTEQ does not return to the previous file.

Files created with a RUN command can be chained, but not nested. If a run file contains a RUN command to run itself, BTEQ generates an out-of-memory message after several iterations. Always avoid such a loop.

For information on I/O errors and abends, refer to I/O Errors and Abends.

After exhausting the run file, BTEQ resumes reading commands and requests from the standard input stream.

The RUN command cannot be used in a Teradata SQL macro.

For workstation-attached systems, a BOM is optional at the beginning of a UTF-8 or UTF-16 RUN file when a Unicode I/O encoding is being used. Also, when BTEQ is started with the -m command line option, stdio is based on the system locale. Therefore, the RUN file must contain locale-specific characters (instead of UTF-8 or UTF-16 encoded characters) and cannot contain a BOM.

For mainframe-attached systems, a RUN file must be encoded in EBCDIC, even for Unicode sessions.

Example – RUN

To read commands from the file POSTING, type: