Purpose
Submits an operating system command to a workstation-attached system. For Mainframe BTEQ, see “TSO” on page 349.
Syntax
where:
Syntax Element |
Specification |
os_command |
A string that represents a valid operating system command. |
Usage Notes
The specified operating system command must be valid for execution on the operating system in use. To use more than one operating system command, send the BTEQ OS command repeatedly, or send the operating system command that enables control to be given to another program. This is accomplished differently in each operating system.
The OS command can be used to look at the complete contents of a closed export file. Using the OS command to look at the contents of an open export file might not display the last few records in the file, though they transfer to the file when the file is closed. This is because the last few records are still in the buffer, and have not yet been written to disk. (See “EXPORT” on page 158 for more information about closing an export file.)
An OS command can be used in a Teradata SQL macro, but only for one specific command at a time. (That is, do not use it to drop into the command processor or shell).
The command is issued to the operating system in the UTF-8 encoding for Workstation BTEQ, whenever the I/O encoding is UTF8 or UTF16. The use of multi-byte characters in the OS command is not supported and might produce unpredictable results.
Example - List Directory Files
Use one of the following OS commands to display the files in a directory:
.OS ls
.OS DIR
Example - UNIX OS
For a UNIX system, use the UNIX command EXECUTE SHELL to exit from BTEQ and press and hold the keys Control and D to return to BTEQ.
For example:
.OS exec s
$ pg myfile.one
$ cp oldfile newfile
$ cd draft
$ <cntrl>/<d>
Example - Windows
For Windows, use the DOS command COMMAND (secondary command processor) to exit from BTEQ and the EXIT command to return to BTEQ.
.OS command
C> type b:myfile.one
C> edlin b:myfile.one
C> dir a:
C> exit
Example - Teradata SQL
In a Teradata SQL macro, the OS command is written as follows:
ECHO '.OS ls';
Example - Change Window Title
When multiple instances of Windows BTEQ are active, the .OS command with the DOS command TITLE can be used to customize the console windows’ title text so they can be differentiated. The following example changes the default title to mach1:
.OS TITLE mach1