Changing the Command Sequence - Basic Teradata Query

Basic Teradata Query Reference

Product
Basic Teradata Query
Release Number
16.20
Published
October 2018
Language
English (United States)
Last Update
2020-02-20
dita:mapPath
kil1527114222313.ditamap
dita:ditavalPath
Audience_PDF_include.ditaval
dita:id
B035-2414
lifecycle
previous
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
.logoff

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
.logoff
.exit