Command Line Options - Basic Teradata Query

Basic Teradata Query Reference

Product
Basic Teradata Query
Release Number
16.10
Published
May 2017
Language
English (United States)
Last Update
2018-06-28
dita:mapPath
wmy1488824663431.ditamap
dita:ditavalPath
Audience_PDF_include.ditaval
dita:id
B035-2414
lifecycle
previous
Product Category
Teradata Tools and Utilities

For workstation-attached systems, use the following BTEQ command line options:

  • -V [Verbose version information]
  • -Vs [Non-verbose version information]
  • -c [Charset Encoding]
  • -e [I/O Encoding]
  • -m

The -V option causes BTEQ to just return its own version information using the "Teradata BTEQ <version> for <platform>" format.

The -Vs option causes short form BTEQ version information to be generated, comprised of only the version value itself.

The -c option defines the initial session character set encoding for BTEQ at startup time. This value can be a character set name or a character set code. By default, this option also defines the I/O encoding BTEQ uses if the -e and -m options are not used (see below).

The -c option overrides charset values defined in the clispb.dat file. To start a UTF-16 session, this option is required. The SESSION CHARSET command can subsequently be used (certain restrictions apply; see SESSION CHARSET) to change BTEQ's session character set. If the -c option and the clispb.dat file are not used to define a session character set, BTEQ sets SESSION CHARSET to ASCII.

The -e option defines the I/O encoding BTEQ uses. This option is valid only when BTEQ is initially set to use a UTF8 or UTF16 session character set (either through the -c option or through the clispb.dat file). The value supplied must be the UTF8 or UTF16 name or code (63 or 62, respectively). Once the -e option has been used, the I/O encoding cannot be changed for that session. It is recommended that the -e option be used before the -c option.

The -m option indicates that I/O encoding for an interactive Unicode session is encoded in multibyte characters based on the system locale, instead of true Unicode code points. This option does not use arguments and requires the use of the -c option, but not the -e option. Without this option, BTEQ always uses the default “C” locale.

Disclaimer:When a locale is in effect (activated by the -m option), BTEQ is limited to the type of characters that it can handle. For example, Thai characters cannot be read or displayed when a Russian locale is used. Characters outside the locale are most likely substituted with question marks ('?').

Example for defining the locale on Windows:

  1. Open the Control Panel.
  2. Select Regional and Language Options.
  3. Select a value for Language for non-Unicode programs.

    The appropriate language support might have to be installed first if the required language is not available.

  4. A reboot might be necessary.

Example for defining the locale on a UNIX operating system:

  1. Use "locale -a" to view the available locales.
  2. Set the LC_CTYPE environment variable to an available locale.

When these options and BTEQ commands are specified on the command line, the command line options must be defined first. Examples for using the command line options include those shown in the following table:

Command Line Options Description
bteq Interactive mode: charset and I/O encoding default to ASCII.
bteq -c ASCII < script Batch mode using an ASCII script: charset and I/O encoding are ASCII.
bteq -c KANJISJIS_0S Interactive mode: charset and I/O encoding are KanjiShift-JIS.
bteq -c UTF8 < script Batch mode using a UTF-8 script: charset and I/O encoding are UTF8.
bteq -c UTF16 < script Batch mode using a UTF-16 script: charset and I/O encoding are UTF16.
bteq -e UTF8 -c UTF16 < script Batch mode using a UTF-8 script: charset is UTF16, I/O encoding is UTF8.
bteq -e 62 -c 63 < script Batch mode using a UTF-16 script: charset is UTF8, I/O encoding is UTF16.
bteq -c utf16 -m Interactive mode: charset is UTF16, I/O encoding based on locale.
bteq -c utf8 -m Interactive mode: charset is UTF8, I/O encoding based on locale.
There are no command line options for mainframe-attached systems.
When a interactive Unicode session is used without the -m option, BTEQ is dependent upon the operating system's current language settings, which are assumed to support 7-bit ASCII characters. Therefore, for interactive input, BTEQ reads each character as a single-byte. This means that multibyte Unicode characters are not supported through input interactively. For output, BTEQ can write multibyte Unicode characters to stdout and stderr. However, the operating system might not recognize a multibyte Unicode character, and might display each byte separately instead. This is not an issue when BTEQ is run in batch mode.
If the command line entries do not contain flag options, the input is treated as though it came from stdin/SYSIN. This is true for both Workstation as well as Mainframe BTEQ.

For Mainframe BTEQ, the command line input can be passed in the JCL PARM parameter of the BTEQ STEP, and should follow following IBM/C rules for specifying the run-time options and program arguments:

When... Format
Only run-time options are present run-time options/
Only program arguments are present
  1. If a slash is present in the arguments, a preceding slash is mandatory.
  2. If a slash is not present in the arguments, a preceding slash is optional.
One of the following:
  1. /program arguments
  2. program arguments or

    /program arguments

Both run-time options and program arguments are present, run-time options / program arguments

For example:

//BTEQ00   EXEC PGM=BTQMAIN,PARM='.RUN DDNAME RUNFILE'

(a leading '/' is needed because the logon string contains '/')

//BTEQ00   EXEC PGM=BTQMAIN,PARM='/.LOGON TDP0/DBC,DBC'