Changing the Command Sequence - Basic Teradata Query

Basic Teradata Query Reference

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

Only a few changes are needed to the sequence of requests and commands to produce a report. Use an editor to add the following commands to the file:

  1. Insert an EXPORT command after the LOGON command to divert the report results to a file called report.out.

    For mainframe-attached systems, enter the following commands:

    .tso allocate ddname(repfile) dsname(report.out) shr
    .export report ddname=repfile

    For workstation-attached systems, enter the following command:

    .export report file=report.out 
  2. After the EXPORT command, enter the following RTITLE command to place a report title at the top of each page of the report, along with the date and page number.
    .set rtitle 'Department Information'
  3. To enable (activate) page formatting commands, add a FORMAT command before and after the SQL EXECUTE command as follows:
    .set format on
    execute deptdisplay;
    .set format off
  4. Use the RESET option of the EXPORT command to end diversion of the report results:
    .export reset 

Example – Mainframe-Attached

This is an example of a file on a mainframe-attached system:

.logon tdpid/userid, password
.tso allocate ddname(repfile) dsname(report.out) shr
.export report ddname=repfile
.set rtitle 'Department information'
.set format on execute deptdisplay;
.set format off 
.export reset

Example – Workstation-Attached

This is an example of a file on a workstation-attached system:

.logon tdpid/userid, password
.export report file=report.out
.set rtitle 'Department Information'
.set format on
execute deptdisplay;
.set format off
.export reset