ERROROUT

Basic Teradata Query Reference

brand
Teradata Tools and Utilities
prodname
Basic Teradata Query
vrm_release
16.20
category
Programming Reference
featnum
B035-2414-108K

Purpose

This control enables users to specify which output stream BTEQ is to use for writing error messages.

Syntax



where the following is true:

STDOUT
Error messages will be written to the standard output stream (SYSPRINT on mainframe-attached systems). This is mainframe BTEQ's initial default setting.
STDERR
Error messages will be written to the standard error stream (SYSTERM on mainframe-attached systems). This is workstation BTEQ's initial default setting.

Usage Notes

Error messages consist of those generated by BTEQ itself, or those passed to it by CLI or the database.

For a Unicode session on a workstation-attached system, if stdout or stderr is being redirected to a file or pipe, the ‑ob command line option can be used to insert an appropriate BOM (Byte Order Mark) to one or both streams.

The ERROROUT command is valid in a Teradata SQL macro.

Example 1 – ERROROUT instigated by a macro

The following shows BTEQ output (stdout/SYSPRINT). Notice that only the first invalid command produces an error message in this stream. The second invalid command produces an error message in stderr/SYSTERM (not shown).

+---------+---------+---------+---------+-----
.set errorout stdout
 *** Error messages now directed to STDOUT.
+---------+---------+---------+---------+-----
.set badcmd1
 *** Error: Unrecognized command 'BADCMD1'.
+---------+---------+---------+---------+-----
.set errorout stderr
 *** Error messages now directed to STDERR.
+---------+---------+---------+---------+-----
.set badcmd2
+---------+---------+---------+---------+-----

Example 2 – ERROROUT instigated by a macro

To have a Teradata SQL macro issue the ERROROUT command, embed it within the string portion of an SQL ECHO statement as follows:

ECHO '.SET ERROROUT STDERR';