17.10 - OUTPUT - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - Database Utilities

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Configuration
Publication ID
B035-1102-171K
Language
English (United States)

The OUTPUT command is used to display or to change the output destination. OUTPUT creates a new log file, overwrites an existing log file, appends an existing log file, and displays output to the screen.

Syntax

{ OUTPUT | OUT }
  [ [ ECHO ] { TO | OVER | INTO } { file | STDOUT | ME } ] ;

Syntax Elements

OUTPUT
OUT
If OUTPUT or OUT is specified by itself, the current output destination is displayed.
ECHO
If specified, output is written to both the console and file.
If not specified, the default is to redirect output to the file.
TO
Specifies that a new file should be created. If the file already exists, then an error is returned.
INTO
Appends output to an existing file.
If the file does not exist, it will be created.
OVER
Overwrites an existing file with new output.
If the file does not exist, it will be created.
file
The fully qualified or a relative path filename.
A fully qualified filename starts with '/' (for example, /var/tmp/checklog).
If a relative path filename is specified (such as checklog or checktable/checklog), then it is created under the default directory, which is the PDE Temp directory, /var/opt/teradata/tdtemp.
If a directory is specified in the file path, then that directory must exist or an error occurs, and the directory is not be created.
STDOUT
Default file to which output is written.
ME
Synonym for STDOUT.

Usage Notes

  • Specifying OUTPUT/OUT by itself displays the current output destination. By default, the output destination is the console (STDOUT), so you must explicitly specify the OUTPUT command to create a log file.

    By sending output to both the console and log file, the ECHO option allows users to monitor progress of the CHECK command on the console and generates a log file for reference purposes. This is especially helpful if the CHECK command runs for a long time or generates a great deal of output. Use the ECHO option to see table failures in the log file or to review output for a particular table.

    Because the log file provides a complete record of the CHECK command run, it can be helpful to browse through the log file using a text editor.

    The log file remains open until the CheckTable session is closed or until the next OUTPUT command is issued. Command output is written to the log file as long as the file is open. The log file can contain multiple command outputs, so a copy of the command line is written to the log file to distinguish one output from another.

    If output is redirected to a file, some commands may still output to the console. This occurs for commands that are more user-interactive and need to display output to the user. Commands like HELP, STATUS, OUTPUT, and interactive help (F7) fall into this category. The STATUS and interactive help commands will only display output to the console. The HELP and OUTPUT commands will display output to both the console and log file.

    CheckTable does not manage the log files. The files remain until deleted by the user.

  • The CheckTable log file is located on the node that runs the control AMP. To determine which node is running the control AMP, use the STATUS command of the Vproc Manager utility. The control AMP is designated under the Logical Configuration with an asterisk. For more information, see CheckTable (checktable).
  • If a file system error occurs during a log file write operation, an error message is written on the console and log file processing is halted. The current output destination reverts automatically back to the default (STDOUT).
  • When running multiple instances of the CheckTable utility on the same system, do not use a single log file for both CheckTable instances.

Example: Displaying current output destination

To display the current output destination:

OUTPUT;

Example: Redirecting output to a file

To redirect output to a new file using a relative path filename:

OUT TO checklog;

Example: Echoing output to the console and a file

To echo output to the console and overwrite a file using a fully qualified filename:

OUTPUT ECHO OVER /var/tmp/checklog;

Example: Redirecting output and appending to a file

To redirect output and append to an existing log file:

OUT INTO checklog;

Example: Specifying an irregular output file name

To specify an irregular file name:

OUT TO 'check log';

Example: Resetting output destination to console screen

To reset output back to the console:

OUT TO STDOUT;