Teradata Parallel Data Pump
Teradata Parallel Data Pump Reference - Teradata Developer ...
Teradata Parallel Data Pump Reference - Teradata Developer ...
- No tags were found...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong><br />
Reference<br />
Release 13.10<br />
B035-3021-020A<br />
February 2010
The product or products described in this book are licensed products of <strong>Teradata</strong> Corporation or its affiliates.<br />
<strong>Teradata</strong>, BYNET, DBC/1012, DecisionCast, DecisionFlow, DecisionPoint, Eye logo design, InfoWise, Meta Warehouse, MyCommerce,<br />
SeeChain, SeeCommerce, SeeRisk, <strong>Teradata</strong> Decision Experts, <strong>Teradata</strong> Source Experts, WebAnalyst, and You’ve Never Seen Your Business Like<br />
This Before are trademarks or registered trademarks of <strong>Teradata</strong> Corporation or its affiliates.<br />
Adaptec and SCSISelect are trademarks or registered trademarks of Adaptec, Inc.<br />
AMD Opteron and Opteron are trademarks of Advanced Micro Devices, Inc.<br />
BakBone and NetVault are trademarks or registered trademarks of BakBone Software, Inc.<br />
EMC, PowerPath, SRDF, and Symmetrix are registered trademarks of EMC Corporation.<br />
GoldenGate is a trademark of GoldenGate Software, Inc.<br />
Hewlett-Packard and HP are registered trademarks of Hewlett-Packard Company.<br />
Intel, Pentium, and XEON are registered trademarks of Intel Corporation.<br />
IBM, CICS, RACF, Tivoli, and z/OS are registered trademarks of International Business Machines Corporation.<br />
Linux is a registered trademark of Linus Torvalds.<br />
LSI and Engenio are registered trademarks of LSI Corporation.<br />
Microsoft, Active Directory, Windows, Windows NT, and Windows Server are registered trademarks of Microsoft Corporation in the United<br />
States and other countries.<br />
Novell and SUSE are registered trademarks of Novell, Inc., in the United States and other countries.<br />
QLogic and SANbox are trademarks or registered trademarks of QLogic Corporation.<br />
SAS and SAS/C are trademarks or registered trademarks of SAS Institute Inc.<br />
SPARC is a registered trademark of SPARC International, Inc.<br />
Sun Microsystems, Solaris, Sun, and Sun Java are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States and other<br />
countries.<br />
Symantec, NetBackup, and VERITAS are trademarks or registered trademarks of Symantec Corporation or its affiliates in the United States<br />
and other countries.<br />
Unicode is a collective membership mark and a service mark of Unicode, Inc.<br />
UNIX is a registered trademark of The Open Group in the United States and other countries.<br />
Other product and company names mentioned herein may be the trademarks of their respective owners.<br />
THE INFORMATION CONTAINED IN THIS DOCUMENT IS PROVIDED ON AN “AS-IS” BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER<br />
EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR<br />
NON-INFRINGEMENT. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION<br />
MAY NOT APPLY TO YOU. IN NO EVENT WILL TERADATA CORPORATION BE LIABLE FOR ANY INDIRECT, DIRECT, SPECIAL, INCIDENTAL,<br />
OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS OR LOST SAVINGS, EVEN IF EXPRESSLY ADVISED OF THE POSSIBILITY OF<br />
SUCH DAMAGES.<br />
The information contained in this document may contain references or cross-references to features, functions, products, or services that are<br />
not announced or available in your country. Such references do not imply that <strong>Teradata</strong> Corporation intends to announce such features,<br />
functions, products, or services in your country. Please consult your local <strong>Teradata</strong> Corporation representative for those features, functions,<br />
products, or services available in your country.<br />
Information contained in this document may contain technical inaccuracies or typographical errors. Information may be changed or updated<br />
without notice. <strong>Teradata</strong> Corporation may also make improvements or changes in the products or services described in this information at any<br />
time without notice.<br />
To maintain the quality of our products and services, we would like your comments on the accuracy, clarity, organization, and value of this<br />
document. Please e-mail: teradata-books@lists.teradata.com<br />
Any comments or materials (collectively referred to as “Feedback”) sent to <strong>Teradata</strong> Corporation will be deemed non-confidential. <strong>Teradata</strong><br />
Corporation will have no obligation of any kind with respect to Feedback and will be free to use, reproduce, disclose, exhibit, display, transform,<br />
create derivative works of, and distribute the Feedback and derivative works thereof without limitation on a royalty-free basis. Further, <strong>Teradata</strong><br />
Corporation will be free to use any ideas, concepts, know-how, or techniques contained in such Feedback for any purpose whatsoever, including<br />
developing, manufacturing, or marketing products or services incorporating Feedback.<br />
Copyright © 1996-2010 by <strong>Teradata</strong> Corporation. All Rights Reserved.
Preface<br />
Purpose<br />
This book provides information about <strong>Teradata</strong> T<strong>Pump</strong>, which is a <strong>Teradata</strong> ® Tools and<br />
Utilities product. <strong>Teradata</strong> Tools and Utilities is a group of products designed to work with<br />
<strong>Teradata</strong> <strong>Data</strong>base.<br />
<strong>Teradata</strong> T<strong>Pump</strong> is a data loading utility that helps maintain (update, delete, insert, and<br />
atomic upsert) the data in <strong>Teradata</strong> <strong>Data</strong>base. <strong>Teradata</strong> T<strong>Pump</strong> uses standard <strong>Teradata</strong> SQL to<br />
achieve moderate to high data loading rates to <strong>Teradata</strong> <strong>Data</strong>base. Multiple sessions and<br />
multi-statement requests are typically used to increase throughput.<br />
Audience<br />
This book is intended for use by:<br />
• System and application programmers<br />
• System administrators<br />
Supported Releases<br />
This book supports the following releases:<br />
• <strong>Teradata</strong> <strong>Data</strong>base 13.10<br />
• <strong>Teradata</strong> Tools and Utilities 13.10<br />
• <strong>Teradata</strong> T<strong>Pump</strong>Version 13.10<br />
Note: See “<strong>Teradata</strong> T<strong>Pump</strong> Script Example” on page 72 to verify the <strong>Teradata</strong> T<strong>Pump</strong><br />
version number.<br />
To locate detailed supported release information:<br />
1 Go to http://www.info.teradata.com/.<br />
2 Under Online Publications, click General Search.<br />
3 Type 3119 in the Publication Product ID box.<br />
4 Under Sort By, select Date.<br />
5 Click Search.<br />
6 Open the version of the <strong>Teradata</strong> Tools and Utilities ##.##.## Supported Platforms and<br />
Product Versions spreadsheet associated with this release.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 3
Preface<br />
Prerequisites<br />
The spreadsheet includes supported <strong>Teradata</strong> <strong>Data</strong>base versions, platforms, and product<br />
release numbers.<br />
Prerequisites<br />
The following prerequisite knowledge is required for this product:<br />
• Basic computer technology<br />
• SQL and <strong>Teradata</strong> SQL<br />
• <strong>Teradata</strong> <strong>Data</strong>base, database management systems<br />
• <strong>Teradata</strong> utilities that load and retrieve data<br />
Changes to This Book<br />
The following changes were made to this book in support of the current release. Changes are<br />
marked with change bars. For a complete list of changes to the product, see the Release<br />
Definition associated with this release.<br />
Date and Release<br />
February 2010<br />
<strong>Teradata</strong> Tools and<br />
Utilities 13.10<br />
April 2009<br />
<strong>Teradata</strong> Tools and<br />
Utilities 13.00<br />
Description<br />
• IBM C is used to develop <strong>Teradata</strong> T<strong>Pump</strong> replacing SAS/C.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> is now supported on z/Linux, and discontinued on z/<br />
VM and MP-RAS<br />
• Updated Compiling and Linking Routines. See Appendix C: “INMOD<br />
and Notify Exit Routine Examples”.<br />
• Updated sample outputs for all Invocation Examples. See Appendix B:<br />
“<strong>Teradata</strong> T<strong>Pump</strong> Examples”<br />
• <strong>Teradata</strong> T<strong>Pump</strong> supports Temporal Semantics.<br />
• To ensure data integrity when target tables have identity columns, use<br />
ROBUST ON in the BEGIN LOAD command<br />
• Added a section on how to avoid data errors.<br />
• The ACCEPT command now supports environment variables.<br />
• Added information on Loading No Primary Index (NoPI) tables in<br />
chapter 1.<br />
• Changed packing factor from 600 to 2430.<br />
4 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Preface<br />
Additional Information<br />
Date and Release<br />
August 2008<br />
<strong>Teradata</strong> Tools and<br />
Utilities 13.00<br />
Description<br />
• Included information about not using a semicolon in object names<br />
• Added Appendix D, User-Defined-Types and User-Defined-Methods<br />
• Updated IBM terminology<br />
• ACCEPT and SET commands can now be run before LOGON and<br />
LOGDATA<br />
• Added PERIOD data type<br />
• Made changes to the Decimal data type specifications<br />
• Described restrictions object names and semicolon(;)<br />
• Added Geospatial type information<br />
• Made changes concerning checkpoint specified as zero<br />
• Updated IBM and NCR naming<br />
• Updated troubleshooting exits with and error code 8<br />
Additional Information<br />
Additional information that supports this product and <strong>Teradata</strong> Tools and Utilities is available<br />
at the web sites listed in the table that follows. In the table, mmyx represents the publication<br />
date of a manual, where mm is the month, y is the last digit of the year, and x is an internal<br />
publication code. Match the mmy of a related publication to the date on the cover of this book.<br />
This ensures that the publication selected supports the same release.<br />
Type of Information Description Access to Information<br />
Release overview<br />
Late information<br />
Use the Release Definition for the following<br />
information:<br />
• Overview of all of the products in the<br />
release<br />
• Information received too late to be<br />
included in the manuals<br />
• Operating systems and <strong>Teradata</strong><br />
<strong>Data</strong>base versions that are certified to<br />
work with each product<br />
• Version numbers of each product and<br />
the documentation for each product<br />
• Information about available training<br />
and the support center<br />
1 Go to http://www.info.teradata.com/.<br />
2 Under Online Publications, click General Search.<br />
3 Type 2029 in the Publication Product ID box.<br />
4 Click Search.<br />
5 Select the appropriate Release Definition from<br />
the search results.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 5
Preface<br />
Additional Information<br />
Type of Information Description Access to Information<br />
Additional product<br />
information<br />
CD-ROM images<br />
Ordering<br />
information for<br />
manuals<br />
General information<br />
about <strong>Teradata</strong><br />
Use the <strong>Teradata</strong> Information Products web<br />
site to view or download specific manuals<br />
that supply related or additional<br />
information to this manual.<br />
Access a link to a downloadable CD-ROM<br />
image of all customer documentation for<br />
this release. Customers are authorized to<br />
create CD-ROMs for their use from this<br />
image.<br />
Use the <strong>Teradata</strong> Information Products web<br />
site to order printed versions of manuals.<br />
The <strong>Teradata</strong> home page provides links to<br />
numerous sources of information about<br />
<strong>Teradata</strong>. Links include:<br />
• Executive reports, case studies of<br />
customer experiences with <strong>Teradata</strong>,<br />
and thought leadership<br />
• Technical information, solutions, and<br />
expert advice<br />
• Press releases, mentions, and media<br />
resources<br />
1 Go to http://www.info.teradata.com/.<br />
2 Under the Online Publications subcategory,<br />
Browse by Category, click <strong>Data</strong> Warehousing.<br />
3 Do one of the following:<br />
• For a list of <strong>Teradata</strong> Tools and Utilities<br />
documents, click <strong>Teradata</strong> Tools and Utilities,<br />
and then select an item under Releases or<br />
Products.<br />
• Select a link to any of the data warehousing<br />
publications categories listed.<br />
Specific books related to <strong>Teradata</strong> T<strong>Pump</strong> are as<br />
follows:<br />
• Introduction to <strong>Teradata</strong> B035-2425-mmyx<br />
• SQL Fundamentals, B035-1141-mmyx<br />
• SQL External Routine Programming, B035-<br />
1147-mmyx<br />
• <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference<br />
B035-3021-mmyx<br />
• <strong>Teradata</strong> Tools and Utilities Command Summary<br />
B035-2401-mmyx<br />
• <strong>Teradata</strong> Tools and Utilities Access Module<br />
Programmer Guide B035-2425-mmyx<br />
1 Go to http://www.info.teradata.com/.<br />
2 Under the Online Publications subcategory,<br />
Browse by Category, click <strong>Data</strong> Warehousing.<br />
3 Click CD-ROM List and Images.<br />
4 Follow the ordering instructions.<br />
1 Go to http://www.info.teradata.com/.<br />
2 Under Print & CD Publications, click How to<br />
Order.<br />
3 Follow the ordering instructions.<br />
1 Go to <strong>Teradata</strong>.com.<br />
2 Select a link.<br />
6 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Table of Contents<br />
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3<br />
Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3<br />
Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3<br />
Supported Releases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3<br />
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4<br />
Changes to This Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4<br />
Additional Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5<br />
Chapter 1:<br />
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15<br />
<strong>Teradata</strong> T<strong>Pump</strong> Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15<br />
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15<br />
Complementing MultiLoad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16<br />
<strong>Teradata</strong> T<strong>Pump</strong> Support Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />
What it Does. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />
How it Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18<br />
Operating Features and Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22<br />
Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22<br />
Input <strong>Data</strong> Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22<br />
Client Character Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />
<strong>Data</strong> Conversion Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />
Checkpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />
Unicode Character Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />
Client Character Set/Client Type Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26<br />
<strong>Teradata</strong> T<strong>Pump</strong> Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />
<strong>Teradata</strong> T<strong>Pump</strong> Command Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28<br />
<strong>Teradata</strong> SQL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30<br />
The <strong>Teradata</strong> T<strong>Pump</strong> Task. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />
Task Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33<br />
DML Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33<br />
Upsert Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33<br />
<strong>Teradata</strong> T<strong>Pump</strong> Macros. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33<br />
Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 7
Table of Contents<br />
Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34<br />
Fallback vs. Nonfallback Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36<br />
Chapter 2:<br />
Using <strong>Teradata</strong> T<strong>Pump</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37<br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37<br />
<strong>Teradata</strong> T<strong>Pump</strong> Support Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37<br />
File Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41<br />
IBM Mainframe Client-Based Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41<br />
UNIX- and Windows-based Systems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42<br />
Interactive Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42<br />
Batch Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43<br />
Run-time Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44<br />
Examples - Redirection of Inputs and Outputs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50<br />
Terminating <strong>Teradata</strong> T<strong>Pump</strong>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51<br />
Normal Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51<br />
Abort Termination. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52<br />
After Terminating a <strong>Teradata</strong> T<strong>Pump</strong> Job. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52<br />
Restart and Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52<br />
Basic <strong>Teradata</strong> T<strong>Pump</strong> Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53<br />
Protection and Location of <strong>Teradata</strong> T<strong>Pump</strong> <strong>Data</strong>base Objects . . . . . . . . . . . . . . . . . . . . .53<br />
Reinitialize a <strong>Teradata</strong> T<strong>Pump</strong> Job. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55<br />
Recover an Aborted <strong>Teradata</strong> T<strong>Pump</strong> Job. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55<br />
Recover from Script Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56<br />
Program Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56<br />
<strong>Teradata</strong> T<strong>Pump</strong> Command Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56<br />
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .58<br />
ANSI/SQL DateTime <strong>Data</strong> Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62<br />
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63<br />
Specify a Character Set. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63<br />
Graphic <strong>Data</strong> Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66<br />
Graphic Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67<br />
Restrictions and Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67<br />
Termination Return Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68<br />
Writing a <strong>Teradata</strong> T<strong>Pump</strong> Job Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69<br />
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69<br />
Script Writing Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69<br />
Procedure for Writing a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71<br />
<strong>Teradata</strong> T<strong>Pump</strong> Script Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72<br />
View <strong>Teradata</strong> T<strong>Pump</strong> Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74<br />
8 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Table of Contents<br />
<strong>Teradata</strong> T<strong>Pump</strong> Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75<br />
<strong>Teradata</strong> T<strong>Pump</strong> Options Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79<br />
Logoff/Disconnect Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80<br />
Progress Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80<br />
Monitor <strong>Teradata</strong> T<strong>Pump</strong> Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81<br />
Monitor Interface Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81<br />
<strong>Teradata</strong> T<strong>Pump</strong> Monitor Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83<br />
<strong>Teradata</strong> T<strong>Pump</strong> Monitor Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83<br />
Estimating Space Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85<br />
Space Calculation Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86<br />
Chapter 3:<br />
<strong>Teradata</strong> T<strong>Pump</strong> Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89<br />
Syntax Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89<br />
Object Name Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89<br />
Geospatial <strong>Data</strong> Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89<br />
Large Decimal and BIGINT Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90<br />
<strong>Teradata</strong> T<strong>Pump</strong> Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90<br />
<strong>Teradata</strong> T<strong>Pump</strong> <strong>Teradata</strong> SQL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91<br />
ACCEPT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93<br />
BEGIN LOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96<br />
DATABASE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108<br />
DATEFORM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109<br />
DELETE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111<br />
DISPLAY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113<br />
DML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115<br />
Serialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119<br />
The Basic Upsert Feature. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123<br />
Upsert. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123<br />
The Atomic Upsert Feature. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125<br />
END LOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129<br />
EXECUTE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130<br />
FIELD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133<br />
FILLER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142<br />
IF, ELSE, and ENDIF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144<br />
IMPORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146<br />
INSERT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157<br />
Temporal Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 9
Table of Contents<br />
LAYOUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160<br />
LOGDATA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163<br />
LOGMECH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164<br />
LOGOFF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165<br />
LOGON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167<br />
LOGTABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171<br />
NAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173<br />
PARTITION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175<br />
ROUTE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179<br />
RUN FILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181<br />
SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183<br />
SYSTEM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185<br />
TABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .186<br />
UPDATE Statement and Atomic Upsert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188<br />
Temporal Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189<br />
Chapter 4:<br />
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195<br />
Early Error Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195<br />
Error Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195<br />
Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .196<br />
Reading <strong>Teradata</strong> T<strong>Pump</strong> Error Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199<br />
Avoiding <strong>Data</strong> Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200<br />
Acquisition Error Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200<br />
Interpreting Error Table Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .201<br />
<strong>Teradata</strong> T<strong>Pump</strong> Performance Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202<br />
Chapter 5:<br />
Using INMOD and Notify Exit Routines. . . . . . . . . . . . . . . . . . . . . . . . . . .203<br />
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .203<br />
INMOD Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .203<br />
Notify Exit Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .204<br />
Programming Languages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .204<br />
Programming Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205<br />
Routine Entry Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205<br />
The <strong>Teradata</strong> T<strong>Pump</strong>/INMOD Routine Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206<br />
10 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Table of Contents<br />
<strong>Teradata</strong> T<strong>Pump</strong>/Notify Exit Routine Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208<br />
Rules and Restrictions for Using Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211<br />
Using INMOD and Notify Exit Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213<br />
<strong>Teradata</strong> T<strong>Pump</strong>-specific Restrictions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213<br />
<strong>Teradata</strong> T<strong>Pump</strong>/INMOD Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214<br />
Preparing the INMOD Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216<br />
INMOD Input Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216<br />
INMOD Output Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217<br />
Programming INMODs for UNIX-based Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218<br />
Compiling and Linking a C INMOD on a UNIX-based Client. . . . . . . . . . . . . . . . . . . . 218<br />
Compiling and Linking a C INMOD on Sun Solaris SPARC . . . . . . . . . . . . . . . . . . . . . 219<br />
Compiling and Linking a C INMOD on a Sun Solaris Opteron . . . . . . . . . . . . . . . . . . . 220<br />
Compiling and Linking a C INMOD on HP-UX PA RISC . . . . . . . . . . . . . . . . . . . . . . . 221<br />
Compiling and Linking a C INMOD on HP-UX Itanium. . . . . . . . . . . . . . . . . . . . . . . . 222<br />
Compiling and Linking a C INMOD on IBM AIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223<br />
Compiling and Linking a Notify Exit Routine on IBM AIX . . . . . . . . . . . . . . . . . . . . . . 223<br />
Compiling and Linking a C INMOD on a Linux Client . . . . . . . . . . . . . . . . . . . . . . . . . 225<br />
Compiling and Linking a C INMOD on a z/Linux Client . . . . . . . . . . . . . . . . . . . . . . . . 225<br />
Compiling and Linking a C INMOD on on IBM OS z/OS . . . . . . . . . . . . . . . . . . . . . . . 226<br />
Programming INMODs for a Windows Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227<br />
Compiling and Linking a C INMOD on a Windows Client . . . . . . . . . . . . . . . . . . . . . . 227<br />
Appendix A:<br />
How to Read Syntax Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229<br />
Syntax Diagram Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229<br />
Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231<br />
Multiple Legitimate Phrases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233<br />
Sample Syntax Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234<br />
Diagram Identifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234<br />
Appendix B:<br />
<strong>Teradata</strong> T<strong>Pump</strong> Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235<br />
Simple Script Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235<br />
Restarted Upsert Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239<br />
Example Using the TABLE Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 11
Table of Contents<br />
Appendix C:<br />
INMOD and Notify Exit Routine Examples . . . . . . . . . . . . . . . . . . . . . . .247<br />
C INMOD - UNIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247<br />
Sample Notify Exit Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .250<br />
Appendix D:<br />
User-Defined-Types<br />
and User-Defined-Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .257<br />
User-Defined-Types and User-Defined-Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .257<br />
User-Defined Types (UDTs). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .257<br />
User-Defined-Methods (UDMs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .258<br />
Creating UDTs with <strong>Teradata</strong> T<strong>Pump</strong>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .258<br />
Inserting and Retrieving UDTs with Client Products. . . . . . . . . . . . . . . . . . . . . . . . . . . . .258<br />
External Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .258<br />
Inserting UDTs with <strong>Teradata</strong> T<strong>Pump</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259<br />
Retrieving UDTs with <strong>Teradata</strong> T<strong>Pump</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259<br />
Retrieving UDT Metadata with <strong>Teradata</strong> T<strong>Pump</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259<br />
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .261<br />
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .271<br />
12 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
List of Tables<br />
Table 1: <strong>Teradata</strong> T<strong>Pump</strong> <strong>Data</strong> Formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22<br />
Table 2: Standard Character Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />
Table 3: Japanese Character Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />
Table 4: Chinese Character Sets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24<br />
Table 5: Korean Character Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24<br />
Table 6: General Guidelines for Choosing Client Character Sets . . . . . . . . . . . . . . . . . . . . . . . 27<br />
Table 7: <strong>Teradata</strong> T<strong>Pump</strong> Command Input Activities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28<br />
Table 8: <strong>Teradata</strong> T<strong>Pump</strong> Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />
Table 9: teradata SQL Statements in <strong>Teradata</strong> T<strong>Pump</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30<br />
Table 10: Comparison of Fallback and Nonfallback Target Tables . . . . . . . . . . . . . . . . . . . . . 36<br />
Table 11: <strong>Data</strong> Sets, Files and Input/Output Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41<br />
Table 12: Run-time Parameters/Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45<br />
Table 13: <strong>Teradata</strong> T<strong>Pump</strong> Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56<br />
Table 14: <strong>Teradata</strong> T<strong>Pump</strong> Conditional Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57<br />
Table 15: Predefined System Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59<br />
Table 16: Ways to Either Specify a Character Set or Accept a Default Specification . . . . . . . 64<br />
Table 17: Character Set Specifications for AXSMOD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65<br />
Table 18: Character Sets Impact on <strong>Teradata</strong> T<strong>Pump</strong> Commands . . . . . . . . . . . . . . . . . . . . . 65<br />
Table 19: GRAPHIC <strong>Data</strong> Types for datadesc option in FIELD or FILLER Statement . . . . . 66<br />
Table 20: Restrictions and Limitations on Operational Features and Functions . . . . . . . . . . 67<br />
Table 21: Termination Return Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68<br />
Table 22: <strong>Teradata</strong> T<strong>Pump</strong> Statistics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75<br />
Table 23: Monitor Interface Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81<br />
Table 24: <strong>Teradata</strong> T<strong>Pump</strong> Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90<br />
Table 25: <strong>Teradata</strong> T<strong>Pump</strong> <strong>Teradata</strong> SQL Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92<br />
Table 26: Events that Create Notifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105<br />
Table 27: DATEFORM Command Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109<br />
Table 28: ANSI/SQL DateTime Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139<br />
Table 29: <strong>Teradata</strong> T<strong>Pump</strong> Error Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196<br />
Table 30: Acquisition Error Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200<br />
Table 31: INMOD Routines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204<br />
Table 32: Programming Routines by Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 13
List of Tables<br />
Table 33: Entry Points for INMOD Routines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205<br />
Table 34: NOTIFY EXIT Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206<br />
Table 35: <strong>Teradata</strong> T<strong>Pump</strong>-to-INMOD Status Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206<br />
Table 36: INMOD-to-<strong>Teradata</strong> T<strong>Pump</strong> Interface Status Codes. . . . . . . . . . . . . . . . . . . . . . . .207<br />
Table 37: Events Passed to the Notify Exit Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208<br />
Table 38: INMOD Input Return Code Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .216<br />
Table 39: INMOD Output Return Code Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .217<br />
14 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
CHAPTER 1<br />
Overview<br />
This chapter provides an introduction to <strong>Teradata</strong> T<strong>Pump</strong>. Topics include:<br />
• <strong>Teradata</strong> T<strong>Pump</strong> Utility<br />
• Operating Features and Capabilities<br />
• <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
• The <strong>Teradata</strong> T<strong>Pump</strong> Task<br />
<strong>Teradata</strong> T<strong>Pump</strong> Utility<br />
The following information provides a general overview of the <strong>Teradata</strong> T<strong>Pump</strong> utility.<br />
Description<br />
<strong>Teradata</strong> T<strong>Pump</strong> is a data loading utility that helps maintain (update, delete, insert, and<br />
atomic upsert) the data in <strong>Teradata</strong> <strong>Data</strong>base. <strong>Teradata</strong> T<strong>Pump</strong> allows near-real time data to<br />
be achieved in the data warehouse.<br />
<strong>Teradata</strong> T<strong>Pump</strong> uses standard <strong>Teradata</strong> SQL to achieve moderate to high data loading rates to<br />
<strong>Teradata</strong> <strong>Data</strong>base. Multiple sessions and multistatement requests are typically used to<br />
increase throughput.<br />
<strong>Teradata</strong> T<strong>Pump</strong> provides an alternative to <strong>Teradata</strong> MultiLoad for the low volume batch<br />
maintenance of large databases under control of a <strong>Teradata</strong> system. Instead of updating<br />
<strong>Teradata</strong> <strong>Data</strong>bases overnight, or in batches throughout the day, <strong>Teradata</strong> T<strong>Pump</strong> updates<br />
information in real time, acquiring data from the client system with low processor utilization.<br />
It does this through a continuous feed of data into the data warehouse, rather than through<br />
traditional batch updates. Continuous updates result in more accurate, timely data.<br />
Unlike most load utilities, <strong>Teradata</strong> T<strong>Pump</strong> uses row hash locks rather than table level locks.<br />
This allows queries to be run while <strong>Teradata</strong> T<strong>Pump</strong> is running. This also means that <strong>Teradata</strong><br />
T<strong>Pump</strong> can be stopped instantaneously.<br />
<strong>Teradata</strong> T<strong>Pump</strong> provides a dynamic throttling feature that enables it to run “all out” during<br />
batch windows, but within limits when it may impact other business uses of <strong>Teradata</strong><br />
<strong>Data</strong>base. Operators can specify the number of statements run per minute, or may alter<br />
throttling minute-by-minute, if necessary.<br />
<strong>Teradata</strong> T<strong>Pump</strong>’s main attributes are:<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 15
Chapter 1: Overview<br />
<strong>Teradata</strong> T<strong>Pump</strong> Utility<br />
Complementing MultiLoad<br />
• Simple, hassle-free setup – does not require staging of data, intermediary files, or special<br />
hardware.<br />
• Efficient, time-saving operation – jobs can continue running in spite of database restarts,<br />
dirty data, and network slowdowns. Jobs restart without intervention.<br />
• Flexible data management – accepts an infinite variety of data forms from an infinite<br />
number of data sources, including direct feeds from other databases. <strong>Teradata</strong> T<strong>Pump</strong> is<br />
also able to transform that data on the fly before sending it to <strong>Teradata</strong>. SQL statements<br />
and conditional logic are usable within the utilities, making it unnecessary to write<br />
wrapper jobs around the utilities.<br />
Note: Full tape support is not available for any function in <strong>Teradata</strong> T<strong>Pump</strong> for networkattached<br />
client systems. To import data from a tape, a custom access module needs to be<br />
written that interfaces with the tape device. Refer to <strong>Teradata</strong> Tools and Utilities Access Module<br />
Programmer Guide for information about how to write a custom access module.<br />
<strong>Teradata</strong> T<strong>Pump</strong> uses MultiLoad-like syntax, which leverages MultiLoad knowledge and<br />
power, provides easy transition from MultiLoad to <strong>Teradata</strong> T<strong>Pump</strong>, and supports the useful<br />
upsert feature. <strong>Teradata</strong> T<strong>Pump</strong> shares much of its command syntax with MultiLoad, which<br />
facilitates conversion of scripts between the two utilities; however, there are substantial<br />
differences in how the two utilities operate.<br />
<strong>Teradata</strong> T<strong>Pump</strong> complements MultiLoad in the following ways:<br />
• Economies of Scale<br />
• Concurrency<br />
• Resource Consumption<br />
Economies of Scale<br />
MultiLoad has an economy of scale and is not necessarily efficient when operating on really<br />
large tables when there are not many rows to insert or update. For MultiLoad to be efficient, it<br />
must touch more than one row per data block in <strong>Teradata</strong> <strong>Data</strong>base.<br />
For example, to achieve efficient MultiLoad performance on a two billion, 65-byte row table,<br />
composed of 16KB blocks, more than 0.4% of the table (8,125,000 rows) must be affected.<br />
While 0.4% of a table is a small update, eight million records is probably more data than<br />
should be run through a BTEQ script.<br />
Concurrency<br />
MultiLoad is limited to a <strong>Teradata</strong> <strong>Data</strong>base variable limit for the maximum number of<br />
instances running concurrently. <strong>Teradata</strong> T<strong>Pump</strong> does not impose this limit. In addition,<br />
while MultiLoad uses table-level locks, <strong>Teradata</strong> T<strong>Pump</strong> uses row-hash locks, making<br />
concurrent updates on the same table a possibility.<br />
Finally, because of the phased nature of MultiLoad, there are potentially inconvenient<br />
windows of time when MultiLoad cannot be stopped without losing access to the target tables.<br />
16 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 1: Overview<br />
<strong>Teradata</strong> T<strong>Pump</strong> Utility<br />
In contrast, <strong>Teradata</strong> T<strong>Pump</strong> can always be stopped and all of its locks dropped with no ill<br />
effect.<br />
Resource Consumption<br />
MultiLoad is designed for the highest possible throughput, and uses any database and host<br />
resources that help to achieve this capability. There is no way to reduce MultiLoad's resource<br />
consumption—even if a longer run time for the job is acceptable. <strong>Teradata</strong> T<strong>Pump</strong>, however,<br />
has a built-in resource governing facility.<br />
This allows the operator to specify how many updates occur (the statement rate) minute by<br />
minute, and then change the statement rate, while the job continues to run. Thus, this facility<br />
can be used to increase the statement rate during windows when <strong>Teradata</strong> T<strong>Pump</strong> is running<br />
by itself, but then decrease the statement rate later on, if users log on for ad hoc query access.<br />
<strong>Teradata</strong> T<strong>Pump</strong> Support Environment<br />
The data-handling functionality of <strong>Teradata</strong> T<strong>Pump</strong> is enhanced by the <strong>Teradata</strong> T<strong>Pump</strong><br />
support environment. In addition to coordinating activities involved in <strong>Teradata</strong> T<strong>Pump</strong><br />
tasks, it provides facilities for managing file acquisition, conditional processing, and<br />
performing certain <strong>Data</strong> Manipulation Language (DML) and <strong>Data</strong> Definition Language<br />
(DDL) activities on <strong>Teradata</strong> <strong>Data</strong>base. The <strong>Teradata</strong> T<strong>Pump</strong> support environment enables an<br />
additional level of user control over <strong>Teradata</strong> T<strong>Pump</strong>.<br />
For more information, see “<strong>Teradata</strong> T<strong>Pump</strong> Support Environment” on page 37.<br />
What it Does<br />
Within a single invocation of <strong>Teradata</strong> T<strong>Pump</strong>, one or more distinct <strong>Teradata</strong> T<strong>Pump</strong> tasks<br />
can be executed in series with any <strong>Teradata</strong> T<strong>Pump</strong> support commands.<br />
The <strong>Teradata</strong> T<strong>Pump</strong> task provides the acquisition of data from client files for application to<br />
target tables through INSERT, UPDATE, or DELETE statements that specify the full primary<br />
index. <strong>Data</strong> is retrieved from the client, and sent as transaction rows to <strong>Teradata</strong> <strong>Data</strong>base,<br />
which are immediately applied to the various target tables.<br />
Each <strong>Teradata</strong> T<strong>Pump</strong> task can acquire data from one or many client files with similar or<br />
different layouts. From each source record, one or more INSERT, UPDATE, or DELETE<br />
statements can be generated and directed to any target table.<br />
The following concepts may improve how <strong>Teradata</strong> T<strong>Pump</strong> is understood.<br />
• The language of <strong>Teradata</strong> T<strong>Pump</strong> commands and statements is used to describe the task<br />
which needs to be accomplished.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> examines all commands and statements for a task, from the BEGIN<br />
LOAD command through the END LOAD command, before actually executing the task.<br />
• After all commands and statements involved in a given task have been processed and<br />
validated by <strong>Teradata</strong> T<strong>Pump</strong>, the <strong>Teradata</strong> T<strong>Pump</strong> task is executed as described in this<br />
and subsequent chapters.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 17
Chapter 1: Overview<br />
<strong>Teradata</strong> T<strong>Pump</strong> Utility<br />
How it Works<br />
• Optionally, <strong>Teradata</strong> T<strong>Pump</strong> supports data serialization for a given row, which guarantees<br />
that if a row insert is immediately followed by a row update, the insert is processed first.<br />
This is done by hashing records to a given session.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> supports bulletproof restartability using time-based checkpoints. Using<br />
frequent checkpoints provides a greater ease in restarting, but at the expense of the<br />
checkpointing overhead.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> supports upsert logic similar to MultiLoad.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> supports insert/update/delete statements in multiple-record requests.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> uses macros to minimize network overhead. Before <strong>Teradata</strong> T<strong>Pump</strong><br />
begins a load, it sends the statements to <strong>Teradata</strong> <strong>Data</strong>base to create equivalent macros for<br />
every insert/update/delete statement used in the job script. The execute macro requests,<br />
rather than lengthy text requests, are then executed iteratively during a job run.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> supports interpretive, record manipulating and restarting features<br />
similar to MultiLoad.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> supports conditional apply logic, similar to MultiLoad.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> supports error treatment options, similar to MultiLoad.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> runs as a single process.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> supports <strong>Teradata</strong> <strong>Data</strong>base internationalization features such as kanji<br />
character sets.<br />
• Up to 2430 operations can be packed into a single request for network efficiency. The limit<br />
of 2430 may vary as the overall limit for a request is one megabyte. <strong>Teradata</strong> T<strong>Pump</strong><br />
assumes that every statement is a one- or two- (for fallback) step request.<br />
<strong>Teradata</strong> T<strong>Pump</strong> is a <strong>Teradata</strong> utility with functions similar to the MultiLoad utility.<br />
MultiLoad edits <strong>Teradata</strong> tables by processing insert, updates, and deletes, and so does<br />
<strong>Teradata</strong> T<strong>Pump</strong>. This section provides insight into the important differences between<br />
MultiLoad and <strong>Teradata</strong> T<strong>Pump</strong>. All of the information in this section is discussed in further<br />
detail later in this document, either explicitly or by implication.<br />
Methods of Operation<br />
MultiLoad performs <strong>Teradata</strong> <strong>Data</strong>base updates in phases. During the first phase of operation,<br />
MultiLoad uses a special database and CLIv2 protocol for efficiently sending large (64 KB)<br />
data messages to the database. The data is stored in a temporary table. During the second<br />
phase of operation, the temporary table is sorted, then changes from it are applied to various<br />
target tables. In this phase, processing is entirely in the database while MultiLoad on the client<br />
waits to see if the job completes successfully.<br />
<strong>Teradata</strong> T<strong>Pump</strong> performs <strong>Teradata</strong> <strong>Data</strong>base updates asynchronously. Changes are sent in<br />
conventional CLIv2 parcels and applied immediately to target tables. To improve its efficiency,<br />
<strong>Teradata</strong> T<strong>Pump</strong> builds multiple statement requests and provides the serialize option to help<br />
reduce locking overhead.<br />
18 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 1: Overview<br />
<strong>Teradata</strong> T<strong>Pump</strong> Utility<br />
Economy of Scale and Performance<br />
MultiLoad performance improves as change volume increases because, in phase two of<br />
MultiLoad, changes are applied to target tables in a single pass. All changes for any physical<br />
data block are effected using one read and one write of the block. Furthermore, the temporary<br />
table and the sorting process used by MultiLoad are additional overheads that must be<br />
“amortized” through the volume of changes.<br />
<strong>Teradata</strong> T<strong>Pump</strong>, on the other hand, performs better for relatively low change volume because<br />
there is no temporary table overhead. <strong>Teradata</strong> T<strong>Pump</strong> becomes expensive for large volumes<br />
of data because multiple updates to a physical data block will most likely result in multiple<br />
reads and writes of the block.<br />
Loading No Primary Index (NoPI) Tables<br />
A NoPI table has no primary index. These tables can be used as staging tables where data is<br />
always appended to the table, making population of the table generally faster than that of a<br />
traditional table containing a primary index.<br />
NoPI tables could increase performance for <strong>Teradata</strong> T<strong>Pump</strong> Array INSERT.<br />
Multiple Statement Requests<br />
The most important technique used by <strong>Teradata</strong> T<strong>Pump</strong> to improve performance over<br />
MultiLoad is the multiple statement request. Placing more statements in a single request is<br />
beneficial for two reasons. First, it reduces network overhead because large messages are more<br />
efficient than small ones. Secondly, (in ROBUST mode) it reduces <strong>Teradata</strong> T<strong>Pump</strong> recovery<br />
overhead, which amounts to one extra database row written for each request. <strong>Teradata</strong> T<strong>Pump</strong><br />
automatically packs multiple statements into a request based upon the PACK specification in<br />
the BEGIN LOAD command.<br />
Macro Creation<br />
<strong>Teradata</strong> T<strong>Pump</strong> uses macros to efficiently modify tables rather than actual DML commands.<br />
The technique of changing statements into equivalent macros before beginning the job greatly<br />
improves performance.<br />
Specifically, the benefits of using macros are:<br />
• The size of network (and channel) messages sent to the database by <strong>Teradata</strong> T<strong>Pump</strong> are<br />
reduced.<br />
• <strong>Teradata</strong> <strong>Data</strong>base parsing engine overhead is reduced because the execution plans (or<br />
steps) for macros are cached and re-used. This eliminates normal parser handling, where<br />
each request sent by <strong>Teradata</strong> T<strong>Pump</strong> is planned and optimized.<br />
Because the space required by macros is negligible, the only issue regarding macros is where<br />
they are placed in the database. Macros are put into the database that contains the restart log<br />
table or the database specified using the MACRODB keyword in the BEGIN LOAD command.<br />
Locking and Transactional Logic<br />
In contrast to MultiLoad, <strong>Teradata</strong> T<strong>Pump</strong> uses conventional row hash locking, which allows<br />
for some amount of concurrent read and write access to its target tables. At any point,<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 19
Chapter 1: Overview<br />
<strong>Teradata</strong> T<strong>Pump</strong> Utility<br />
<strong>Teradata</strong> T<strong>Pump</strong> can be stopped while retaining full accessibility to the target tables. Note<br />
however, that if <strong>Teradata</strong> T<strong>Pump</strong> is stopped, depending on the nature of the update process,<br />
the relational integrity of the data might be impaired.<br />
This differs from MultiLoad, which operates as a single logical update to one or more target<br />
tables. Once MultiLoad goes into phase two of its logic, the job is essentially irreversible and<br />
all target tables are locked for write access until the job completes.<br />
If <strong>Teradata</strong> T<strong>Pump</strong> operates on rows that have associated triggers, the triggers are invoked as<br />
necessary.<br />
Recovery Logic and Overhead<br />
In <strong>Teradata</strong> T<strong>Pump</strong>’s ROBUST mode, one database row is written in the log restart table for<br />
every request that it issues. This collection of rows in the restart log table can be referred to as<br />
the request log. Because a request is guaranteed by the database to either completely finish or<br />
completely rollback, the request log will always accurately reflect the completion status of a<br />
<strong>Teradata</strong> T<strong>Pump</strong> import. Thus, the request log overhead for restart logic decreases as the<br />
number of statements packed per request increases.<br />
<strong>Teradata</strong> T<strong>Pump</strong> also allows a checkpoint interval to be specified. During the checkpoint<br />
process <strong>Teradata</strong> T<strong>Pump</strong> flushes all pending changes from the import file to the database and<br />
also cleans out the request log. The larger the checkpoint interval, the larger the request log<br />
(and its table) is going to grow. Upon an unexpected restart, <strong>Teradata</strong> T<strong>Pump</strong> scans the<br />
import data source along with the request log in order to re-execute the statements not found<br />
in the request log.<br />
In <strong>Teradata</strong> T<strong>Pump</strong>’s SIMPLE (non-ROBUST) mode, basic checkpoints are created. If a<br />
restart occurs between checkpoints, then some requests will likely be reprocessed. This is<br />
adequate protection under some circumstances.<br />
In contrast, phase one of MultiLoad uses checkpoints so restarts do not force a job to always<br />
restart from the beginning. During phase two, MultiLoad uses its temporary table as a<br />
repository of all changes to be applied. The database process of applying the changes<br />
guarantees that no changes are missed or applied more than once.<br />
Serialization of Changes<br />
In certain uses of <strong>Teradata</strong> T<strong>Pump</strong> or MultiLoad, it is possible to have multiple changes to one<br />
row in a single job. For instance, a row might be inserted, then updated during the batch job,<br />
or it might be updated, then deleted. In any case, the correct ordering of these operations is<br />
obviously very important. MultiLoad automatically guarantees that this ordering of<br />
operations is maintained correctly. By using the serialization feature, <strong>Teradata</strong> T<strong>Pump</strong> can<br />
accomplish the same ordering of operations, but to make it happen in <strong>Teradata</strong> T<strong>Pump</strong>, a<br />
small amount of scripting work and utility overhead are required.<br />
The use of the serialize option on the BEGIN LOAD command guarantees that <strong>Teradata</strong><br />
T<strong>Pump</strong> will send each change for a data record of a given key in order. The KEY modifier to<br />
the FIELD command is how a script specifies that a given field is to be part of the serialization<br />
key. The intent of this feature is to allow specification of the key corresponding to the primary<br />
index of the target table. In fact, the TABLE command automatically qualifies the generated<br />
20 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 1: Overview<br />
<strong>Teradata</strong> T<strong>Pump</strong> Utility<br />
fields with the KEY modifier when the fields are part of the primary index of the table. If the<br />
DML statements in the <strong>Teradata</strong> T<strong>Pump</strong> script specify more than one target table then it is up<br />
to the script author to make sure that primary indices of all the tables match when using the<br />
serialization feature.<br />
The serialization feature works by hashing each data record based upon its key to determine<br />
which session transmits the record to the database. Thus the extra overhead in the application<br />
is derived from the mathematical operation of hashing and from the extra amount of<br />
buffering necessary to save data rows when a request is already pending on the session chosen<br />
for transmission.<br />
The serialization feature greatly reduces the potential frequency of database deadlock.<br />
Deadlocks can occur when requests for the application happen to affect row(s) that use the<br />
same hash code within the database. Although deadlocks are handled by the database and by<br />
<strong>Teradata</strong> T<strong>Pump</strong> correctly, the resolution process is time-consuming and adds additional<br />
overhead to the application because it must re-execute requests that roll back due to deadlock.<br />
In addition to using SERIALIZEON in the BEGIN LOAD command, the SERIALIZEON<br />
keyword can also be specified in the DML command. This lets serialization to be turned on for<br />
the fields specified. For more information on the DML-based serialization feature, refer to<br />
“DML” on page 115.<br />
Dual <strong>Data</strong>base Strategy<br />
The serialization feature is intended to support a variety of other potential customer<br />
applications that go under the general heading dual database. These are applications that in<br />
some way take a live feed of inserts, updates, and deletes from another database and apply<br />
them without any preprocessing to <strong>Teradata</strong> <strong>Data</strong>base.<br />
Both <strong>Teradata</strong> T<strong>Pump</strong> and MultiLoad are potential parts of the dual database strategy. A dual<br />
database application will generate a DML stream which will be routed to <strong>Teradata</strong> T<strong>Pump</strong> or<br />
MultiLoad through a paramod/inmod specific to the application. The choice between<br />
<strong>Teradata</strong> T<strong>Pump</strong> or MultiLoad will depend on such things as the volume of data (with higher<br />
volumes favoring MultiLoad) and the concurrent access requirements (with greater access<br />
requirements favoring <strong>Teradata</strong> T<strong>Pump</strong>).<br />
Resource Usage and Limitations<br />
A feature unique to <strong>Teradata</strong> T<strong>Pump</strong> is the ability to constrain run-time resource usage<br />
through the statement rate feature. <strong>Teradata</strong> T<strong>Pump</strong> provides control over the rate per minute<br />
at which statements are sent to the database and the statement rate correlates directly to<br />
resource usage on both the client and in the database. The statement rate can be controlled in<br />
two ways, either dynamically while the job is running, or it can be scripted into the job with<br />
the RATE keyword on the BEGIN LOAD command. Dynamic control over the statement rate<br />
is provided by updates to a table on the database.<br />
In contrast with <strong>Teradata</strong> T<strong>Pump</strong>, MultiLoad always uses CPU and memory very efficiently.<br />
During phase one (assuming that the database is not a bottleneck), MultiLoad will probably<br />
bottleneck on the client, consuming significant network or channel resources. During phase<br />
two, MultiLoad uses very significant database disk, CPU, and memory resources. In fact, the<br />
database limits the number of concurrent MultiLoad, FastLoad, and FastExport jobs for the<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 21
Chapter 1: Overview<br />
Operating Features and Capabilities<br />
very reason that they are so resource-intensive. <strong>Teradata</strong> T<strong>Pump</strong> has no such databaseimposed<br />
limitation.<br />
Warning:<br />
Although <strong>Teradata</strong> <strong>Data</strong>base imposes no limitation on the number of concurrent <strong>Teradata</strong><br />
T<strong>Pump</strong> jobs that are possible, an excessive number of small jobs causes contention on the<br />
<strong>Teradata</strong> <strong>Data</strong>base system catalogue. The limit will vary from one installation to another, and<br />
each installation should determine its own capacity for running a multiplicity of <strong>Teradata</strong> T<strong>Pump</strong><br />
jobs to avoid potential deadlocks.<br />
Operating Features and Capabilities<br />
The following section describes the operating modes; input data formats; and client, unicode,<br />
and site-defined character sets for <strong>Teradata</strong> T<strong>Pump</strong>. For information about supported<br />
operating systems, refer to <strong>Teradata</strong> Tools and Utilities ##.##.## Supported and Certified<br />
Versions, B035-3119 for this release at http://www.info.teradata.com/.<br />
Operating Modes<br />
<strong>Teradata</strong> T<strong>Pump</strong> runs in the following operating modes:<br />
• Interactive – Interactive processing involves the more or less continuous participation of<br />
the user.<br />
• Batch – Batch programs process data in discrete groups of previously scheduled<br />
operations, typically in a separate operation, rather than interactively or in real-time.<br />
Input <strong>Data</strong> Formats<br />
Table 1 lists the input data formats supported on UNIX and Windows platforms. Mainframes<br />
have standard records.<br />
Table 1: <strong>Teradata</strong> T<strong>Pump</strong> <strong>Data</strong> Formats<br />
<strong>Data</strong> Format<br />
BINARY<br />
FASTLOAD<br />
TEXT<br />
UNFORMAT<br />
VARTEXT<br />
Description<br />
Specifies that each input record is a 2-byte integer, n, followed by n bytes of data.<br />
Specifies that each input record is a 2-byte integer, n, followed by n bytes of data,<br />
followed by an end-of-record marker, either X'0A' or X'0D'.<br />
Specifies that each input record is an arbitrary number of bytes followed by an endof-record<br />
marker, which is a:<br />
• Linefeed (X'0A') on UNIX platforms.<br />
• Carriage-return/linefeed pair (X'0D0A') on Windows platforms.<br />
Specifies that each input record is defined by FIELD commands of the specified<br />
layout.<br />
Specifies that each variable-length text record has each field separated by a<br />
delimiter character.<br />
22 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 1: Overview<br />
Operating Features and Capabilities<br />
Client Character Sets<br />
For a description of the supported input file formats, see the discussion of the FORMAT<br />
option for network-attached client systems in the IMPORT Command description in<br />
Chapter 3: “<strong>Teradata</strong> T<strong>Pump</strong> Commands.”<br />
Standard Character Sets<br />
Table 2 lists the standard character sets which are supported by <strong>Teradata</strong> <strong>Data</strong>base.<br />
Table 2: Standard Character Sets<br />
Standard Character Sets<br />
System Configuration<br />
Channel-Attached<br />
Network-Attached<br />
Name<br />
EBCDIC<br />
ASCII<br />
The terms ASCII and EBCDIC are often used in ambiguous ways, and this presents a difficulty<br />
for accented and non-Latin characters. The user should select a client character set that exactly<br />
matches the character set that the import data uses.<br />
If accented and non-Latin characters are used, do not use the ASCII or EBCDIC client<br />
character sets. Instead, load and use one of the other <strong>Teradata</strong>-supplied character sets, or a<br />
site-defined character set that exactly matches the application character set, such as:<br />
EBCDIC037_0E for channel-attached clients (for the United States or Canada), LATIN1_0A,<br />
LATIN9_0A (for Western European languages), LATIN1252_0A for Western European<br />
Microsoft ® Windows clients, or UTF-8 for UNIX clients.<br />
Japanese Characters Sets<br />
Table 3 lists the Japanese character sets which are supported by <strong>Teradata</strong> <strong>Data</strong>base.<br />
Table 3: Japanese Character Sets<br />
Japanese Character Sets<br />
System Configuration<br />
Channel-Attached<br />
Character Set Name<br />
KATAKANAEBCDIC<br />
KANJIEBCDIC5026_0I<br />
KANJIEBCDIC5035_0I<br />
Network-Attached<br />
KANJIEUC_0U<br />
KANJISJIS_0S<br />
For more information on kanji character sets, refer to International Character Set Support.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 23
Chapter 1: Overview<br />
Operating Features and Capabilities<br />
Caution:<br />
<strong>Teradata</strong> T<strong>Pump</strong> statements do not accept object names specified in internal database<br />
hexadecimal form and do not display object names in hexadecimal form.<br />
Chinese and Korean Character Sets<br />
Chinese and Korean character sets are available for channel- and network-attached client<br />
systems.<br />
Table 4 lists the Chinese character sets:<br />
Table 4: Chinese Character Sets<br />
Chinese Character Sets<br />
System Configuration<br />
Channel-Attached<br />
Name<br />
SCHEBCDIC935_2IJ<br />
TCHEBCDIC937_3IB<br />
Network-Attached<br />
SCHGB2312_1T0<br />
TCHBIG5_1R0<br />
Table 5 lists the Korean character sets:<br />
Table 5: Korean Character Sets<br />
Korean Character Sets<br />
System Configuration<br />
Channel-Attached<br />
Network-Attached<br />
Name<br />
HANGULEBCDIC933_1II<br />
HANGULKSC5601_2R4<br />
Rules for Using Chinese and Korean Character Sets<br />
Certain rules apply when using Chinese and Korean character sets on channel- and networkattached<br />
platforms.<br />
• Object Names<br />
<strong>Teradata</strong> <strong>Data</strong>base supports multi-byte characters in object names when the client session<br />
character set is UTF-8 or UTF-16. For a list of valid and non-valid characters when multibyte<br />
object names are used, see the Appendix of International Character Set Support.<br />
If multi-byte characters are used in object names in <strong>Teradata</strong> T<strong>Pump</strong> script, they must be<br />
enclosed in double quotes.<br />
• Maximum String Length<br />
<strong>Teradata</strong> <strong>Data</strong>base requires two bytes to process each of the Chinese or Korean characters.<br />
This limits both request size and record size. For example, if a record consists of one string,<br />
the length of that string is limited to a maximum of 32,000 characters or 64,000 bytes.<br />
24 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 1: Overview<br />
Operating Features and Capabilities<br />
<strong>Data</strong> Conversion Capabilities<br />
<strong>Teradata</strong> T<strong>Pump</strong> can redefine the data type specification of numeric, character, and date input<br />
data so it matches the type specification of its destination column in the <strong>Teradata</strong> T<strong>Pump</strong><br />
table on <strong>Teradata</strong> <strong>Data</strong>base.<br />
For example, if an input field with numeric type data is targeted for a column with a character<br />
data type specification, <strong>Teradata</strong> T<strong>Pump</strong> can change the input data specification to character<br />
before inserting it into the table.<br />
The datadesc specification of the <strong>Teradata</strong> T<strong>Pump</strong> FIELD command is used to convert input<br />
data to a different type before inserting it into a table on <strong>Teradata</strong> <strong>Data</strong>base.<br />
The types of data conversions which can be specified are:<br />
• Numeric-to-numeric (for example integer-to-decimal)<br />
• Character-to-numeric<br />
• Character-to-date<br />
• Date-to-character<br />
Note: Redundant conversions, such as integer-to-integer, are legal and necessary to support<br />
the zoned decimal format. For more information about the zoned decimal format, data types,<br />
and data conversions, see SQL <strong>Data</strong> Types and Literals.<br />
Checkpoints<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports the use of checkpoints. Checkpoints are entries posted to a restart<br />
log table at regular intervals during the <strong>Teradata</strong> T<strong>Pump</strong> data transfer operation. If processing<br />
stops while a <strong>Teradata</strong> T<strong>Pump</strong> job is running, the job can be restarted at the most recent<br />
checkpoint.<br />
For example, assume 1,000,000 records are being loaded into a table and have specified<br />
checkpoints every 50,000 records. Then <strong>Teradata</strong> T<strong>Pump</strong> pauses and posts an entry to the<br />
restart log table whenever multiples of 50,000 records are successfully sent to <strong>Teradata</strong><br />
<strong>Data</strong>base.<br />
If the job stops after record 60,000 has been loaded, the job can be restarted at the record<br />
immediately following the last checkpoint—record 50,001.<br />
To enable the checkpoint function, specify a checkpoint value in the BEGIN LOAD command.<br />
For more information, see “BEGIN LOAD” on page 96.<br />
Unicode Character Sets<br />
UTF-8 and UTF-16 are two of the standard ways of encoding Unicode character data. <strong>Teradata</strong><br />
<strong>Data</strong>base supports UTF-8 and UTF-16client character sets. The UTF-8 client character set<br />
supports UTF-8 encoding. Currently, <strong>Teradata</strong> <strong>Data</strong>base supports UTF-8 characters that can<br />
consist of from one to three bytes. The UTF-16client character set supports UTF-16 encoding.<br />
Currently, <strong>Teradata</strong> <strong>Data</strong>base supports the Unicode 5.0 standard, where each defined<br />
character requires exactly 16 bits.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 25
Chapter 1: Overview<br />
Operating Features and Capabilities<br />
There are restrictions imposed by <strong>Teradata</strong> <strong>Data</strong>base on using the UTF-8 or UTF-16 character<br />
set. Refer to International Character Set Support for restriction details.<br />
UTF-8 Character Sets<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports UTF-8 character set on network-attached platforms and IBM z/OS.<br />
On IBM z/OS, the job script must be in <strong>Teradata</strong> EBCDIC when using UTF-8 client character<br />
set. <strong>Teradata</strong> T<strong>Pump</strong> will translate commands in the job script from <strong>Teradata</strong> EBCDIC to<br />
UTF-8 during the load. Be sure to examine the definition in International Character Set<br />
Support to determine the code points of any special characters which might be required in the<br />
job script. Different versions of EBCDIC do not always agree as to the placement of these<br />
characters. Refer to the mappings between <strong>Teradata</strong> EBCDIC and Unicode in Appendix E of<br />
International Character Set Support.<br />
Currently, UTF-8 Byte Order Mark (BOM) is not supported on the z/OS platform when using<br />
access modules or data files.<br />
See Chapter 3 for complete information on <strong>Teradata</strong> T<strong>Pump</strong> commands. Refer to<br />
• parameters commands nullexpr<br />
• fieldexpr<br />
• VARTEXT format delimiter<br />
• WHERE condition<br />
• CONTINUEIF condition<br />
for additional information on using UTF-8 client character set on the mainframe.<br />
UTF-16 Character Sets<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports UTF-16 character set on network-attached platforms. In general,<br />
the command language and the job output should be the same as the client character set used<br />
by the job. However, for user’s convenience and because of the special property of Unicode,<br />
the command language and the job output are not required to be the same as the client<br />
character set when using UTF-16 character set. When using UTF-16 character set, the job<br />
script and the job output can either be in UTF-8 or UTF-16 character set. This is provided by<br />
specifying runtime parameters "-i" and "-u" when the job is invoked.<br />
For more reference information on runtime parameters “-i” and “-u”, see parameters<br />
-i scriptencoding and -u outputencoding on “-u outputencoding” on page 46.<br />
Also refer to parameters commands fieldexpr “fieldexpr” on page 135, nullexpr on “nullexpr”<br />
on page 134, WHERE condition on “WHERE condition” on page 111 and CONTINUEIF<br />
condition on “CONTINUEIF condition” on page 161 for additional information on using<br />
UTF-16 client character set.<br />
Client Character Set/Client Type Compatibility<br />
Table 6 is a general guideline for choosing client character sets that may work better for the<br />
client environment.<br />
26 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 1: Overview<br />
<strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
Table 6: General Guidelines for Choosing Client Character Sets<br />
Client Type<br />
Best Client Character Sets<br />
Channel-attached • EBCDIC<br />
• EBCDIC037_0E<br />
• KANJIEBCDIC5026_0I<br />
• KANJIEBCDIC5035_0I<br />
• KATAKANAEBCDIC<br />
• SCHEBCDIC935_2IJ<br />
• TCHEBCDIC937_3IB<br />
• HANGULEBCDIC933_1II<br />
• UTF-8<br />
Network-attached running UNIX • ASCII<br />
• KANJIEUC_0U<br />
• LATIN1_0A<br />
• LATIN9_0A<br />
• UTF-8<br />
• UTF-16<br />
• SCHGB2312_1T0<br />
• TCHBIG5_1R0<br />
• HANGULKSC5601_2R4<br />
Network-attached running Windows • ASCII<br />
• KANJISJIS_0S<br />
• LATIN1252_0A<br />
• UTF-8<br />
• UTF-16<br />
• SCHGB2312_1T0<br />
• TCHBIG5_1R0<br />
• HANGULKSC5601_2R4<br />
Site-Defined Character Sets<br />
When the character sets defined by <strong>Teradata</strong> <strong>Data</strong>base are not appropriate for a site, custom<br />
character sets can be defined.<br />
Refer to <strong>Teradata</strong> <strong>Data</strong>base International Character Set Support for information on defining<br />
custom own character set.<br />
<strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
<strong>Teradata</strong> T<strong>Pump</strong> accepts both <strong>Teradata</strong> T<strong>Pump</strong> commands and a subset of <strong>Teradata</strong> SQL<br />
statements. These are described in the following sections:<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 27
Chapter 1: Overview<br />
<strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
<strong>Teradata</strong> T<strong>Pump</strong> Command Input<br />
<strong>Teradata</strong> T<strong>Pump</strong> commands perform two types of activities, Support and Task.<br />
Table 7 provides a description of those activities and functions.<br />
Table 7: <strong>Teradata</strong> T<strong>Pump</strong> Command Input Activities<br />
Activity<br />
Support<br />
Task<br />
Description<br />
Support commands establish the <strong>Teradata</strong> T<strong>Pump</strong> sessions with <strong>Teradata</strong> <strong>Data</strong>base and<br />
establish the operational support environment for <strong>Teradata</strong> T<strong>Pump</strong>.<br />
Support commands are not directly involved in specifying a <strong>Teradata</strong> T<strong>Pump</strong> task.<br />
The <strong>Teradata</strong> T<strong>Pump</strong> task commands specify the actual processing that takes place for<br />
each MultiLoad task.<br />
The task commands, combined with <strong>Teradata</strong> SQL INSERT, UPDATE, and DELETE<br />
statements, are used to define <strong>Teradata</strong> T<strong>Pump</strong> IMPORT and DELETE tasks.<br />
Table 8 lists the <strong>Teradata</strong> T<strong>Pump</strong> commands that perform the support and task activities:<br />
28 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 1: Overview<br />
<strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
Table 8: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
Activity<br />
<strong>Teradata</strong><br />
T<strong>Pump</strong><br />
Command<br />
Function<br />
Support ACCEPT Allows the value of one or more utility variables to be accepted from either a file or an<br />
environment variable.<br />
DATEFORM<br />
DISPLAY<br />
ELSE (see<br />
IF, ELSE, and<br />
ENDIF)<br />
ENDIF (see<br />
IF, ELSE, and<br />
ENDIF)<br />
IF (see IF,<br />
ELSE, and<br />
ENDIF)<br />
LOGDATA<br />
LOGMECH<br />
LOGOFF<br />
LOGON<br />
LOGTABLE<br />
NAME<br />
ROUTE<br />
RUN FILE<br />
SET<br />
SYSTEM<br />
Lets the form of the DATE data type specifications be defined for the <strong>Teradata</strong> T<strong>Pump</strong> job<br />
Writes messages to the specified destination<br />
Followed by commands and statements which execute when the preceding IF command is false<br />
Delimits the group of <strong>Teradata</strong> T<strong>Pump</strong> commands and statements that were subject to previous<br />
IF or ELSE commands or both<br />
When followed by a conditional expression, initiates execution of subsequent commands and<br />
statements<br />
Supplies parameters to the LOGMECH command beyond those needed by the logon<br />
mechanism, such as user ID and password, to successfully authenticate the user<br />
Identifies the appropriate logon mechanism by name<br />
Disconnects all active sessions and terminates <strong>Teradata</strong> T<strong>Pump</strong> support on the client<br />
Specifies the LOGON string to be used in connecting all sessions established by <strong>Teradata</strong> T<strong>Pump</strong><br />
Identifies the table to be used for journaling checkpoint information required for safe, automatic<br />
restart of the <strong>Teradata</strong> T<strong>Pump</strong> support environment in the event of a client or <strong>Teradata</strong> <strong>Data</strong>base<br />
hardware platform failure<br />
Sets the variable SYSJOBNAME to the jobname string specified. The jobname string can be up to<br />
16 bytes in length and can contain kanji characters<br />
Identifies the destination of output produced by the <strong>Teradata</strong> T<strong>Pump</strong> support environment.<br />
Invokes the specified external source as the current source of commands and statements<br />
Assigns a data type and a value to a utility variable<br />
Suspends <strong>Teradata</strong> T<strong>Pump</strong> to issue commands to the local operating system.<br />
Task BEGIN LOAD Specifies the kind of <strong>Teradata</strong> T<strong>Pump</strong> task to be executed, the target tables to be used, and the<br />
parameters for executing the task<br />
FIELD<br />
DML<br />
END LOAD<br />
Defines a field of the data source record<br />
Used with LAYOUT command<br />
Defines a label and error treatment option(s) for the <strong>Teradata</strong> SQL DML statement(s) following<br />
the DML command<br />
Indicates completion of <strong>Teradata</strong> T<strong>Pump</strong> command entries and initiates execution of the task<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 29
Chapter 1: Overview<br />
<strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
Table 8: <strong>Teradata</strong> T<strong>Pump</strong> Commands (continued)<br />
Activity<br />
<strong>Teradata</strong><br />
T<strong>Pump</strong><br />
Command<br />
FILLER<br />
IMPORT<br />
LAYOUT<br />
PARTITION<br />
TABLE<br />
Function<br />
Defines a field in the data source that is not sent to <strong>Teradata</strong> <strong>Data</strong>base. Used with LAYOUT<br />
command<br />
Identifies the data source, the layout, and the DML operation(s) to be performed, with optional<br />
conditions for performing these operations<br />
Introduces the record format of the data source to be used in the <strong>Teradata</strong> T<strong>Pump</strong> task<br />
This command is followed by a sequence or combination of FIELD, FILLER, and TABLE<br />
commands.<br />
Establishes session partitions to transfer SQL requests to <strong>Teradata</strong> <strong>Data</strong>base<br />
Identifies a table whose column names and data descriptions are used as the field names and data<br />
descriptions of the data source records<br />
Used with LAYOUT command<br />
<strong>Teradata</strong> SQL Statements<br />
<strong>Teradata</strong> SQL statements define and manipulate the data stored in <strong>Teradata</strong> <strong>Data</strong>base.<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports a subset of <strong>Teradata</strong> SQL statements so other utilities do not have to<br />
be invoked to perform routine database maintenance functions before executing <strong>Teradata</strong><br />
T<strong>Pump</strong> utility tasks. For example, use the supported <strong>Teradata</strong> SQL statements to:<br />
• Create the table to load<br />
• Establish a database as an explicit table name qualifier<br />
• Add checkpoint specifications to a journal table<br />
The <strong>Teradata</strong> SQL statements supported by <strong>Teradata</strong> T<strong>Pump</strong> are summarized in Table 9.<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports only the <strong>Teradata</strong> SQL statements listed in this table. To use any<br />
other <strong>Teradata</strong> SQL statements, they must be entered from another application, such as<br />
BTEQ.<br />
The subset of <strong>Teradata</strong> SQL supported by the <strong>Teradata</strong> T<strong>Pump</strong> support environment excludes<br />
user-generated transactions (BEGIN TRANSACTION; END TRANSACTION;).<br />
Table 9 lists the <strong>Teradata</strong> SQL statements supported in <strong>Teradata</strong> T<strong>Pump</strong>.<br />
Table 9: teradata SQL Statements in <strong>Teradata</strong> T<strong>Pump</strong><br />
<strong>Teradata</strong> SQL Statement<br />
ALTER TABLE<br />
CHECKPOINT<br />
COLLECT STATISTICS<br />
Function<br />
Changes the column configuration or options of an existing table<br />
Adds checkpoint entry to a journal table<br />
Collects statistical data for one or more columns of a table<br />
30 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 1: Overview<br />
<strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
Table 9: teradata SQL Statements in <strong>Teradata</strong> T<strong>Pump</strong> (continued)<br />
<strong>Teradata</strong> SQL Statement<br />
COMMENT<br />
CREATE DATABASE<br />
CREATE MACRO<br />
CREATE TABLE<br />
CREATE VIEW<br />
DATABASE<br />
DELETE<br />
DELETE DATABASE<br />
DROP DATABASE<br />
EXECUTE<br />
GIVE<br />
GRANT<br />
INSERT<br />
MODIFY DATABASE<br />
RENAME<br />
REPLACE MACRO<br />
REPLACE VIEW<br />
REVOKE<br />
SET QUERY_BAND<br />
Function<br />
Stores or retrieves a comment string associated with a database<br />
object<br />
Creates a new database, macro, table, or view<br />
Specifies a new default database for the current session<br />
Removes rows from a table<br />
Removes all tables, views, and macros from a database<br />
Removes an empty table from <strong>Teradata</strong> <strong>Data</strong>base<br />
Specifies a user-created (predefined) macro for execution. The<br />
macro named in this statement resides in <strong>Teradata</strong> <strong>Data</strong>base and<br />
specifies the type of DML statement (INSERT, UPDATE, DELETE,<br />
or UPSERT) being handled by the macro.<br />
Transfers ownership of a database to another user<br />
Grants privileges to a database object<br />
Inserts new rows to a table<br />
Changes the options of an existing database<br />
Changes the name of an existing table, view, or macro<br />
Redefines an existing macro or view<br />
Rescinds privileges to a database object<br />
Sets the query band for a session and transaction<br />
Note: The statement can be used in two ways:<br />
SET QUERY_BAND = 'Document=XY1234;<br />
Universe=East;' FOR SESSION;<br />
SET QUERY_BAND = NONE FOR SESSION;<br />
SET SESSION COLLATION<br />
SET SESSION OVERRIDE<br />
REPLICATION ON/OFF<br />
UPDATE Statement and Atomic<br />
Upsert<br />
Overrides the collation specification for the current session<br />
Turn on/off replication service<br />
Changes the column values of an existing row in a table<br />
Now that <strong>Teradata</strong> T<strong>Pump</strong> supports termporal semantics, it scans up to the keywords in the<br />
above list only in the sense that it submits them to <strong>Teradata</strong> <strong>Data</strong>base and deals with the<br />
success, failure, or error response.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 31
Chapter 1: Overview<br />
The <strong>Teradata</strong> T<strong>Pump</strong> Task<br />
While restarting, only DATABASE and SET statements are reexecuted. The existence of a log<br />
table causes <strong>Teradata</strong> T<strong>Pump</strong> on the client to execute its restart logic.<br />
Note that, although SET is in the list, the only SET statements truly supported are the <strong>Teradata</strong><br />
SQL SET statements: SET SESSION COLLATION and SET SESSION DATABASE. Any other<br />
SET statement passed through to <strong>Teradata</strong> <strong>Data</strong>base is rejected.<br />
<strong>Teradata</strong> SQL statements from the input command file are sent to <strong>Teradata</strong> <strong>Data</strong>base for<br />
execution via CLIv2. Pertinent information returned in SUCCESS, FAILURE, or ERROR<br />
parcels is listed in the message destination.<br />
Caution:<br />
Do not issue a DELETE DATABASE statement to delete the database containing the restart log<br />
table because this terminates the <strong>Teradata</strong> T<strong>Pump</strong> job. See “Reinitialize a <strong>Teradata</strong> T<strong>Pump</strong><br />
Job” on page 55 for restart instructions if the restart log table is accidentally dropped.<br />
Support environment statements may be executed between invocations of <strong>Teradata</strong> T<strong>Pump</strong><br />
tasks. These include DATABASE, CHECKPOINT, and CREATE TABLE statements. The<br />
BEGIN LOAD command then starts a <strong>Teradata</strong> T<strong>Pump</strong> task script.<br />
The action of <strong>Teradata</strong> T<strong>Pump</strong> may be directed by commands and DML statements retrieved<br />
from an external source. The data source for these commands and statements may be specified<br />
in the <strong>Teradata</strong> T<strong>Pump</strong> RUN FILE command, if one is used.<br />
The <strong>Teradata</strong> T<strong>Pump</strong> support environment parses lines that begin with a period as<br />
commands. The period distinguishes commands from <strong>Teradata</strong> SQL statements, which are<br />
passed to <strong>Teradata</strong> <strong>Data</strong>base without parsing. More than one statement per line is not allowed<br />
but statements can span multiple lines.<br />
<strong>Teradata</strong> T<strong>Pump</strong> follows the same rules as standard <strong>Teradata</strong> SQL for OPERATIONS on<br />
NULL.<br />
Refer to SQL Fundamentals for more information about using <strong>Teradata</strong> SQL statements.<br />
The <strong>Teradata</strong> T<strong>Pump</strong> Task<br />
The <strong>Teradata</strong> T<strong>Pump</strong> task is designed for the batch application of client data to one or more<br />
tables on <strong>Teradata</strong> <strong>Data</strong>base via DML commands and statements (INSERT, UPDATE, or<br />
DELETE). <strong>Teradata</strong> T<strong>Pump</strong> executes these DML statements in multiple-record requests.<br />
The following topics information provide information about the <strong>Teradata</strong> T<strong>Pump</strong> task:<br />
• Task Limits<br />
• DML Commands<br />
• Upsert Feature<br />
• <strong>Teradata</strong> T<strong>Pump</strong> Macros<br />
• Locks<br />
• Privileges<br />
• Fallback vs. Nonfallback Tables<br />
32 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 1: Overview<br />
The <strong>Teradata</strong> T<strong>Pump</strong> Task<br />
Task Limits<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports only single-row, primary index operations. Up to 2430 of these<br />
operations can be packed into a single request for network efficiency. The 2430 - statement<br />
upper limit is arbitrary and may actually be lower for statements associated with large data<br />
parcels that may exceed the overall limit of 64 KB for a request, or where a statement itself is<br />
very long.<br />
DML Commands<br />
Upsert Feature<br />
<strong>Teradata</strong> T<strong>Pump</strong> Macros<br />
DML commands appear with their associated INSERT, UPDATE, or DELETE DML<br />
statements, together with the IMPORT commands that identify data to be read from the<br />
client.<br />
<strong>Teradata</strong> T<strong>Pump</strong> DML statements support a conditional apply logic similar to MultiLoad, in<br />
which DML statements are applied based on record field contents.<br />
Specified DML statements following a DML command apply data from one or more separate<br />
data sources. The data sources contain a record for each table row to which one or more<br />
statements apply. Each IMPORT command identifies a separate data source, and references<br />
LAYOUT and DML commands. The IMPORT command matches records of the data source<br />
to the applicable DML statement or statements by means of its APPLY clauses.<br />
The LAYOUT command defines the layout of the records of a data source, using the<br />
parameters and a sequence of FIELD, FILLER, and TABLE commands. The DML command<br />
identifies an immediately following set of one or more DML statements.<br />
Each DML statement is converted into a macro and used for the duration of the import.<br />
As <strong>Teradata</strong> T<strong>Pump</strong> reaches the end of one data source, as identified by the IMPORT<br />
command, it continues with the next IMPORT command.<br />
<strong>Teradata</strong> T<strong>Pump</strong>’s upsert feature is a composite of UPDATE and INSERT functionality applied<br />
to a single row. <strong>Teradata</strong> T<strong>Pump</strong> upsert logic is similar to that used in MultiLoad, the only<br />
other load utility with this feature. The DML statements required to execute each iteration of<br />
upsert are a single UPDATE statement, followed by a single INSERT statement.<br />
With upsert, if the UPDATE fails because the target row does not exist, <strong>Teradata</strong> T<strong>Pump</strong><br />
automatically executes the INSERT statement. This capability can save considerable loading<br />
time by completing this operation in a single pass instead of two.<br />
Before beginning a load, <strong>Teradata</strong> T<strong>Pump</strong> creates equivalent macros on the database, based on<br />
the actual DML statements. That is, for every INSERT, UPDATE, DELETE, and UPSERT<br />
statement in the DML statement, <strong>Teradata</strong> T<strong>Pump</strong> creates an equivalent macro for it. These<br />
macros are then executed iteratively, in place of the actual DML statement, when an import<br />
task begins, and are removed when all import tasks are complete. The use of macros in place<br />
of lengthy requests helps to minimize network and parsing overhead.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 33
Chapter 1: Overview<br />
The <strong>Teradata</strong> T<strong>Pump</strong> Task<br />
For greater efficiency, <strong>Teradata</strong> T<strong>Pump</strong> also supports the use of predefined macros, rather<br />
than creating macros from the actual DML statements. A predefined macro is created by the<br />
user and resides on the database before a <strong>Teradata</strong> T<strong>Pump</strong> import task begins. When a<br />
predefined macro is used, <strong>Teradata</strong> T<strong>Pump</strong> uses this macro directly instead of creating<br />
another macro. The use of predefined macros allows <strong>Teradata</strong> T<strong>Pump</strong> to avoid the overhead of<br />
creating/dropping macros internally, and also to avoid modifying the data dictionary on<br />
<strong>Teradata</strong> <strong>Data</strong>base during the job run.<br />
<strong>Teradata</strong> T<strong>Pump</strong> uses the EXECUTE command to support predefined macros. For more<br />
information on using predefined macros, refer to the EXECUTE command in this manual.<br />
For more information about creating a macro, see SQL <strong>Data</strong> Definition Language.<br />
For more information about executing a macro, see SQL <strong>Data</strong> Manipulation Language.<br />
Locks<br />
Privileges<br />
<strong>Teradata</strong> T<strong>Pump</strong> uses conventional row hash locking, which allows for some amount of<br />
concurrent read and write access to its target tables. At any point, <strong>Teradata</strong> T<strong>Pump</strong> can be<br />
stopped, making the target tables fully accessible. If <strong>Teradata</strong> T<strong>Pump</strong> is stopped, however,<br />
depending on the nature of the update process, the relational integrity of the data may be<br />
compromised.<br />
Although <strong>Teradata</strong> T<strong>Pump</strong> always uses conventional row hash locking, based on the nature of<br />
SQL statements used in the <strong>Teradata</strong> T<strong>Pump</strong> job and the status of the target tables, a <strong>Teradata</strong><br />
T<strong>Pump</strong> job may introduce other levels of locking in a job run. For example, if a target table of<br />
a <strong>Teradata</strong> T<strong>Pump</strong> job has a trigger defined and this trigger uses table-level locking when it is<br />
triggered, this <strong>Teradata</strong> T<strong>Pump</strong> job may cause a table level-locking if such a trigger is triggered<br />
during the run. The <strong>Teradata</strong> T<strong>Pump</strong> script developer should be familiar with the property of<br />
the database on which the <strong>Teradata</strong> T<strong>Pump</strong> job will run and be aware of such possibilities.<br />
<strong>Teradata</strong> T<strong>Pump</strong> users must have privileges on the database containing the log restart table<br />
because <strong>Teradata</strong> T<strong>Pump</strong> orchestrates the creation of macros to use during the task.<br />
Dropping the log table makes it impossible to restart a <strong>Teradata</strong> T<strong>Pump</strong> job. Dropping the<br />
macros or the error table makes it very difficult to restart a <strong>Teradata</strong> T<strong>Pump</strong> job.<br />
<strong>Teradata</strong> T<strong>Pump</strong> does not have any special protections on database objects it creates.<br />
Therefore, it is the responsibility of <strong>Teradata</strong> T<strong>Pump</strong> administrators and users to ensure that<br />
privileges on databases used by <strong>Teradata</strong> T<strong>Pump</strong> have been established.<br />
Most of the privileges for <strong>Teradata</strong> T<strong>Pump</strong> are intuitive. For example:<br />
• CREATE TABLE is required on the database where the log table is placed.<br />
• CREATE TABLE is required on the database where the error table is placed.<br />
• CREATE/DROP MACRO is required on the database where macros are placed.<br />
• EXECUTE MACRO is required on the database where the macros are placed.<br />
34 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 1: Overview<br />
The <strong>Teradata</strong> T<strong>Pump</strong> Task<br />
Macros<br />
The use of macros slightly complicates the privileges for <strong>Teradata</strong> T<strong>Pump</strong>. The remaining<br />
privileges necessary to run a <strong>Teradata</strong> T<strong>Pump</strong> job have two different scenarios:<br />
• When a <strong>Teradata</strong> T<strong>Pump</strong> macro is placed in the same database as the table which it affects,<br />
required rights are INSERT/UPDATE/DELETE on the table affected, corresponding to the<br />
DML executed.<br />
• When a <strong>Teradata</strong> T<strong>Pump</strong> macro is placed in a different database from the table it affects,<br />
required rights specify that the database where the macro is placed must have INSERT/<br />
UPDATE/DELETE, WITH GRANT in the table affected, corresponding to the DML<br />
executed. The EXECUTE MACRO must also be located on the database where the macro<br />
is placed.<br />
Note that when the <strong>Teradata</strong> T<strong>Pump</strong> job uses EXEC to directly specify a macro, the privileges<br />
scenarios are the same, except that the CREATE/DROP MACRO privilege is not required since<br />
the macro exists both before and after the job.<br />
Tables<br />
The corresponding INSERT, UPDATE, or DELETE privilege must exist for each table to be<br />
changed by the <strong>Teradata</strong> T<strong>Pump</strong> task. Multiple tables can be targeted by a single <strong>Teradata</strong><br />
T<strong>Pump</strong> job.<br />
The BEGIN LOAD command invokes <strong>Teradata</strong> T<strong>Pump</strong> to execute task processing. Any<br />
statement of this task applies each matching imported data record to each of its target table<br />
rows having the specified index value. <strong>Teradata</strong> T<strong>Pump</strong> supports all table types. Unlike<br />
MultiLoad, there are no forbidden index types. Thus, the tables may be either empty or<br />
populated, as well as being either with or without secondary indices.<br />
All required data is imported; none is obtained from tables already existing in <strong>Teradata</strong><br />
<strong>Data</strong>base. No statement of an IMPORT task may make any reference to a table or row other<br />
than the one affected by the statement.<br />
All INSERT statements, when considered in conjunction with each applicable imported<br />
record, must explicitly specify values for all columns except those for which a default value<br />
(including null) is defined. All UPDATE and DELETE statements, when considered in<br />
conjunction with each applicable imported record, must explicitly specify values for all<br />
columns of the primary index. In order to fulfill this requirement for UPDATE and DELETE<br />
statements, a series of ANDed terms of either form must be supplied:<br />
or<br />
column_reference = colon_variable_reference<br />
column_reference = constant<br />
<strong>Teradata</strong> T<strong>Pump</strong> does not process UPDATE and DELETE statements that contain ORed terms<br />
because <strong>Teradata</strong> T<strong>Pump</strong> must hash the imported records with a value from the import file<br />
(or with a NULL). Any attempt to use an OR with these statements causes <strong>Teradata</strong> T<strong>Pump</strong> to<br />
fail. To work around this, create two separate DML statements and apply them conditionally.<br />
<strong>Teradata</strong> T<strong>Pump</strong> imposes some restrictions on the updates of an IMPORT task. It rejects<br />
updates that try to change the value of the primary index of a row, but accepts even reflexive<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 35
Chapter 1: Overview<br />
The <strong>Teradata</strong> T<strong>Pump</strong> Task<br />
updates of other columns. A reflexive update of a column computes the new value as the result<br />
of an expression that involves the current value of one or more columns.<br />
<strong>Teradata</strong> T<strong>Pump</strong> processes and validates all statements from the BEGIN LOAD through the<br />
END LOAD statements. <strong>Teradata</strong> T<strong>Pump</strong> control and processing sessions are established and<br />
<strong>Teradata</strong> SQL requests are transmitted to <strong>Teradata</strong> <strong>Data</strong>base. <strong>Teradata</strong> T<strong>Pump</strong> creates a single<br />
error table and a set of macros, one for each DML statement. Nothing protects target tables<br />
from concurrent access.<br />
<strong>Teradata</strong> T<strong>Pump</strong> imports data, evaluating each record according to specified apply conditions.<br />
For each satisfied apply condition, a record is sent to <strong>Teradata</strong> <strong>Data</strong>base. If the record causes<br />
an error, this sequence number is available in the error table so that the record can be<br />
identified.<br />
When the task completes, all locks are released, all macros dropped and, if empty, the error<br />
table is dropped. Statistics concerning the outcome of the IMPORT task are reported.<br />
Access logging can cause a severe performance penalty. If all successful table updates are<br />
logged, a log entry is made for each operation. The primary index of the access logging table<br />
may then create the possibility of row hash conflicts.<br />
Fallback vs. Nonfallback Tables<br />
Target tables can be either fallback or nonfallback.<br />
Table 10 lists the differences between, and characteristics of, these tables.<br />
Table 10: Comparison of Fallback and Nonfallback Target Tables<br />
Fallback Tables<br />
<strong>Teradata</strong> T<strong>Pump</strong> task continues to execute even<br />
if AMPs are down, as long as there is not more<br />
than one AMP down, either logically or<br />
physically in a cluster.<br />
If two or more AMPs in a cluster are logically or<br />
physically down, or both, the task does not run,<br />
or terminates if running.<br />
During the task, if AMPs are down to the extent<br />
that data on the disk is corrupted, the affected<br />
tables must be restored.<br />
Not applicable.<br />
Not applicable.<br />
Nonfallback Tables<br />
If one or more AMPs are down prior to entering<br />
the task and if one or more target tables are<br />
nonfallback, <strong>Teradata</strong> T<strong>Pump</strong> terminates.<br />
The <strong>Teradata</strong> T<strong>Pump</strong> task may be restarted as<br />
soon as all AMPs are back up.<br />
If an AMP goes down once the task has started,<br />
the task cannot be restarted until all AMPs are<br />
back up.<br />
If more than one AMP in the same cluster is<br />
down, <strong>Teradata</strong> <strong>Data</strong>base cannot come up.<br />
Certain I/O errors during the task corrupt the<br />
target table so that it must be restored. In this<br />
case, <strong>Teradata</strong> T<strong>Pump</strong> terminates.<br />
36 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
CHAPTER 2<br />
Using <strong>Teradata</strong> T<strong>Pump</strong><br />
This chapter provides detailed information about using the <strong>Teradata</strong> T<strong>Pump</strong> utility. Topics<br />
include:<br />
• Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
• Terminating <strong>Teradata</strong> T<strong>Pump</strong><br />
• Restart and Recovery<br />
• Program Considerations<br />
• Writing a <strong>Teradata</strong> T<strong>Pump</strong> Job Script<br />
• View <strong>Teradata</strong> T<strong>Pump</strong> Output<br />
• Monitor <strong>Teradata</strong> T<strong>Pump</strong> Jobs<br />
• Estimating Space Requirements<br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
<strong>Teradata</strong> T<strong>Pump</strong> Support Environment<br />
This section describes those <strong>Teradata</strong> T<strong>Pump</strong> functions that are invoked from the <strong>Teradata</strong><br />
T<strong>Pump</strong> support environment on the client system. The <strong>Teradata</strong> T<strong>Pump</strong> support<br />
environment is a platform from which <strong>Teradata</strong> T<strong>Pump</strong> and a number of standard <strong>Teradata</strong><br />
SQL, DDL, and DML operations can be performed. This client program includes a facility for<br />
executing <strong>Teradata</strong> SQL and is separate from <strong>Teradata</strong> T<strong>Pump</strong> tasks that run in <strong>Teradata</strong><br />
<strong>Data</strong>base.<br />
<strong>Teradata</strong> T<strong>Pump</strong> support environment functionality includes:<br />
• Providing access to the data manipulation and data definition functions of the <strong>Teradata</strong><br />
SQL language.<br />
• User-defined variables and variable substitution.<br />
• System-defined variables (for example, date and time).<br />
• Conditional execution based on the value of return codes and variables.<br />
• Expression evaluation.<br />
• Redirection of command input.<br />
• Runtime parameters for <strong>Teradata</strong> T<strong>Pump</strong> invocation, foreign language support, and error<br />
logging functions.<br />
• Character set selection options for IBM mainframe and UNIX client-based systems.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 37
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
The <strong>Teradata</strong> T<strong>Pump</strong> support environment allows preparation for an initial invocation or<br />
resumption of a <strong>Teradata</strong> T<strong>Pump</strong> task without having to invoke multiple distinct utilities. For<br />
example, the table that is to be loaded may need to be created, a database established as an<br />
implicit table-name qualifier, or the relevant permanent journal checkpointed.<br />
Any statement not preceded by a period (.) is assumed to be a <strong>Teradata</strong> SQL statement and is<br />
sent to <strong>Teradata</strong> <strong>Data</strong>base to be processed. An object name in an <strong>Teradata</strong> SQL statement may<br />
contain Katakana or multibyte characters when the appropriate character set is used.<br />
The <strong>Teradata</strong> T<strong>Pump</strong> support environment interprets the commands and statements that<br />
define the job. It also controls the execution of those commands and manages recovery from<br />
<strong>Teradata</strong> <strong>Data</strong>base or client failures during processing.<br />
Those commands not directly involved in defining a <strong>Teradata</strong> T<strong>Pump</strong> task, but providing<br />
supportive functions (routing output, for example), are considered <strong>Teradata</strong> T<strong>Pump</strong> support<br />
commands. These are individually executed as they are encountered.<br />
The commands that define a single <strong>Teradata</strong> T<strong>Pump</strong> task are processed by the client as a single<br />
unit. These are considered to be <strong>Teradata</strong> T<strong>Pump</strong> task commands. The actual execution of the<br />
<strong>Teradata</strong> T<strong>Pump</strong> task is deferred until all pertinent task commands have been considered and<br />
validated by the client program.<br />
Support Environment Input/Output<br />
Support environment Input/Output (I/O) appears in the following forms:<br />
• Command and statement input (default = SYSIN/stdin)<br />
• Accept command input from file<br />
• Command and statement output (default = SYSPRINT/stdout)<br />
• Display command output (default = SYSPRINT/stdout)<br />
• Error output (default = SYSPRINT/stdout)<br />
Note: For IBM statement input, the default is initially the user-provided invocation parameter<br />
(JCL PARM), if specified. After all commands and nested files in the parameter are processed,<br />
the default is SYSIN.<br />
SYSPRINT/stdout Output<br />
The characteristics of SYSPRINT output for z/OS and UNIX standard output (stdout) are:<br />
• The first five positions of each output line are reserved. They contain a statement number<br />
if the line is the beginning of a <strong>Teradata</strong> T<strong>Pump</strong> statement. This also applies to comments<br />
preceding <strong>Teradata</strong> T<strong>Pump</strong> statements.<br />
• If the output line is a <strong>Teradata</strong> T<strong>Pump</strong>-generated message, the first five positions contain<br />
the string ****.<br />
• In all other cases, the first five positions are blank.<br />
• A message indicating the processing start date appears at the beginning of every job.<br />
• <strong>Teradata</strong> T<strong>Pump</strong>-generated messages are preceded by a header displaying system time.<br />
This timestamp appears on the same line as the message and follows the **** string.<br />
38 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
================================<br />
Example<br />
This example depicts each type of SYSPRINT/stdout output line noted in the previous list.<br />
========================================================================<br />
= =<br />
= <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Utility Release 13.10.00.000 =<br />
= Platform IBM-AIX =<br />
= =<br />
========================================================================<br />
= =<br />
= Copyright 1997-2009 <strong>Teradata</strong> Corporation. ALL RIGHTS RESERVED. =<br />
= =<br />
========================================================================<br />
**** 23:24:10 UTY2411 Processing start date: TUE OCT 06, 2009<br />
========================================================================<br />
= =<br />
= Logon/Connection =<br />
= =<br />
========================================================================<br />
0001 /************************************************************************<br />
* This is a sample test for T<strong>Pump</strong>. *<br />
************************************************************************/<br />
.LOGTABLE TPLOG0044;<br />
0002 .LOGON ESTELSA/SUDHANSUDB,;<br />
**** 23:24:14 UTY8400 <strong>Teradata</strong> <strong>Data</strong>base Release: 13.10g.00.53<br />
**** 23:24:14 UTY8400 <strong>Teradata</strong> <strong>Data</strong>base Version: 13.10g.00.53<br />
**** 23:24:14 UTY8400 Default character set: ASCII<br />
**** 23:24:14 UTY8400 Current RDBMS has UDT support<br />
**** 23:24:14 UTY8400 Maximum supported buffer size: 1M<br />
**** 23:24:14 UTY8400 Upsert supported by RDBMS server<br />
**** 23:24:14 UTY8400 <strong>Data</strong> Encryption supported by RDBMS server<br />
**** 23:24:14 UTY8400 Array Support supported by RDBMS server<br />
**** 23:24:15 UTY6211 A successful connect was made to the RDBMS.<br />
**** 23:24:15 UTY6217 Logtable 'SUDHANSUDB.TPLOG0044' has been created.<br />
========================================================================<br />
= =<br />
= Processing Control Statements =<br />
= =<br />
========================================================================<br />
0003 .NAME TPUMP0044;<br />
0004 DROP TABLE TPTBL0044;<br />
**** 23:24:15 UTY1016 'DROP' request successful.<br />
0005 DROP TABLE TPERR0044;<br />
**** 23:24:15 UTY1008 RDBMS failure: 3807, Object 'TPERR0044' does not exist.<br />
0006 CREATE TABLE TPTBL0044, FALLBACK(<br />
F1 INTEGER, F2 CHAR(50),<br />
F3 VARCHAR(50))<br />
UNIQUE PRIMARY INDEX (F1);<br />
**** 23:24:16 UTY1016 'CREATE' request successful.<br />
0007 .BEGIN LOAD CHECKPOINT 15<br />
SESSIONS 4 1<br />
TENACITY 2<br />
ERRORTABLE TPERR0044<br />
ROBUST OFF<br />
NOMONITOR<br />
PACK 500;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 39
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
0008 .LAYOUT LAY0044;<br />
0009 .FIELD FF1 * INTEGER;<br />
0010 .FIELD FF2 * CHAR(50);<br />
0011 .FIELD FF3 * VARCHAR(50);<br />
0012 .DML LABEL LABEL0044;<br />
0013 INSERT INTO TPTBL0044 VALUES ( :FF1, :FF2, :FF3);<br />
0014 .IMPORT INFILE ALLTYPE<br />
LAYOUT LAY0044<br />
APPLY LABEL0044;<br />
0015 .END LOAD;<br />
**** 23:24:16 UTY6609 Starting to log on sessions...<br />
**** 23:24:17 UTY6610 Logged on 4 sessions.<br />
========================================================================<br />
= =<br />
= T<strong>Pump</strong> Import(s) Beginning =<br />
= =<br />
========================================================================<br />
**** 23:24:17 UTY6630 Options in effect for following T<strong>Pump</strong> Import(s):<br />
. Tenacity: 2 hour limit to successfully connect load sessions.<br />
. Max Sessions: 4 session(s).<br />
. Min Sessions: 1 session(s).<br />
. Checkpoint: 15 minute(s).<br />
. Errlimit: No limit in effect.<br />
. Restart Mode: SIMPLE.<br />
. Serialization: OFF.<br />
. Packing: 500 Statements per Request.<br />
. StartUp Rate: UNLIMITED Statements per Minute.<br />
**** 23:24:28 UTY6608 Import 1 begins.<br />
**** 23:24:30 UTY6641 Since last chkpt., 100 recs. in, 100 stmts., 1 reqs<br />
**** 23:24:30 UTY6647 Since last chkpt., avg. DBS wait time: 2.00<br />
**** 23:24:30 UTY6612 Beginning final checkpoint...<br />
**** 23:24:30 UTY6641 Since last chkpt., 100 recs. in, 100 stmts., 1 reqs<br />
**** 23:24:30 UTY6647 Since last chkpt., avg. DBS wait time: 2.00<br />
**** 23:24:30 UTY6607 Checkpoint Completes with 100 rows sent.<br />
**** 23:24:30 UTY6642 Import 1 statements: 100, requests: 1<br />
**** 23:24:30 UTY6643 Import 1 average statements per request: 100.00<br />
**** 23:24:30 UTY6644 Import 1 average statements per record: 1.00<br />
**** 23:24:30 UTY6645 Import 1 statements/session: avg. 25.00, min. 0.00, max. 100.00<br />
**** 23:24:30 UTY6646 Import 1 requests/session: average 0.25, minimum 0.00, maximum 1.00<br />
**** 23:24:30 UTY6648 Import 1 DBS wait time/session: avg. 0.50, min. 0.00, max. 2.00<br />
**** 23:24:30 UTY6649 Import 1 DBS wait time/request: avg. 0.50, min. 0.00, max. 2.00<br />
**** 23:24:30 UTY1803 Import processing statistics<br />
. IMPORT 1 Total thus far<br />
. ========= ==============<br />
Candidate records considered:........ 100....... 100<br />
Apply conditions satisfied:.......... 100....... 100<br />
Records logable to error table:...... 0....... 0<br />
Candidate records rejected:.......... 0....... 0<br />
** Statistics for Apply Label : LABEL0044<br />
Type <strong>Data</strong>base Table or Macro Name Activity<br />
I SUDHANSUDB TPTBL0044 100<br />
**** 23:24:30 UTY0821 Error table SUDHANSUDB.TPERR0044 is EMPTY, dropping table.<br />
0016 .LOGOFF;<br />
========================================================================<br />
= =<br />
= Logoff/Disconnect =<br />
= =<br />
========================================================================<br />
**** 23:24:33 UTY6216 The restart log table has been dropped.<br />
40 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
**** 23:24:33 UTY6212 A successful disconnect was made from the RDBMS.<br />
**** 23:24:33 UTY2410 Total processor time used = '0.269692 Seconds'<br />
. Start : 23:24:10 - TUE OCT 06, 2009<br />
. End : 23:24:33 - TUE OCT 06, 2009<br />
. Highest return code encountered = '0'.<br />
File Requirements<br />
Certain files are required for invoking <strong>Teradata</strong> T<strong>Pump</strong>. In addition to the input data source,<br />
<strong>Teradata</strong> T<strong>Pump</strong> accesses four different data sets/files or input/output devices.<br />
Table 11 lists <strong>Teradata</strong> T<strong>Pump</strong> data sets/files and input/output devices:<br />
Table 11: <strong>Data</strong> Sets, Files and Input/Output Devices<br />
<strong>Data</strong> Set/File or Device<br />
standard input<br />
standard output<br />
standard error<br />
configuration<br />
Provides<br />
<strong>Teradata</strong> T<strong>Pump</strong> commands and <strong>Teradata</strong> SQL statements that<br />
make up a <strong>Teradata</strong> T<strong>Pump</strong> job<br />
Destination for <strong>Teradata</strong> T<strong>Pump</strong> output responses and messages<br />
Destination for <strong>Teradata</strong> T<strong>Pump</strong> errors<br />
Optional specification of <strong>Teradata</strong> T<strong>Pump</strong> utility default values<br />
When running <strong>Teradata</strong> T<strong>Pump</strong> in interactive mode, the keyboard functions as the standard<br />
input device and the display screen is the standard output/error device.<br />
When running <strong>Teradata</strong> T<strong>Pump</strong> in batch mode, specify a data set or file name for each of these<br />
functions. The method of doing this varies, depending on the configuration of the client<br />
system:<br />
• On network-attached client systems, use the standard redirection mechanism (<<br />
infilename and > outfilename) to specify the <strong>Teradata</strong> T<strong>Pump</strong> files when the utility is<br />
invoked.<br />
• On channel-attached client systems, use standard z/OS JCL control statements (DD) to<br />
allocate and create the <strong>Teradata</strong> T<strong>Pump</strong> data sets or files before the utility is invoked.<br />
IBM Mainframe Client-Based Systems<br />
Start <strong>Teradata</strong> T<strong>Pump</strong> with a RUN FILE command, with optional invocation parameters, such<br />
as JCL PARM. These are interpreted as a string of <strong>Teradata</strong> T<strong>Pump</strong> support environment<br />
commands, separated by, and ending with, semicolons.<br />
After invocation, the first two commands executed must be LOGON and LOGTABLE. These<br />
commands are required and are permitted only once. Either can be supplied in the command<br />
string invoking <strong>Teradata</strong> T<strong>Pump</strong>, and the other (or both) can appear in the INPUT file, or in a<br />
file called with the RUN FILE command. No commands can precede the LOGON,<br />
LOGTABLE, or RUN FILE commands.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 41
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
If a RUN FILE command is not used to specify an initial source of commands and <strong>Teradata</strong><br />
SQL statements, <strong>Teradata</strong> T<strong>Pump</strong> defaults to the conventional source of control input, such as<br />
SYSIN.<br />
If a RUN FILE command is found in the parameter (PARM) input, the input source it<br />
identifies is used prior to SYSIN. Whether the input source is specified by RUN FILE, or by<br />
SYSIN, processing continues until a LOGOFF command, the end of control input, or a<br />
terminating error is encountered, whichever occurs first. If all input is exhausted without<br />
encountering a LOGOFF command, or if the program terminates because of an error,<br />
<strong>Teradata</strong> T<strong>Pump</strong> automatically performs the LOGOFF function.<br />
The LOGON command establishes a <strong>Teradata</strong> SQL session that <strong>Teradata</strong> T<strong>Pump</strong> uses for<br />
processing. The LOGTABLE command specifies a table to be used as the restart log in the<br />
event of failure. This table is placed in the default database unless otherwise specified.<br />
CREATE TABLE, INSERT, UPDATE, and SELECT rights must be on the database containing<br />
the restart log table.<br />
Preparatory statements, which are processed by the <strong>Teradata</strong> SQL-processing function of<br />
<strong>Teradata</strong> T<strong>Pump</strong>, must be executed before beginning a <strong>Teradata</strong> T<strong>Pump</strong> task. It is here that<br />
any desired DATABASE statement and any desired CREATE TABLE statements are specified.<br />
At this point, a BEGIN LOAD command initiates a <strong>Teradata</strong> T<strong>Pump</strong> task.<br />
UNIX- and Windows-based Systems<br />
Interactive Mode<br />
Start the <strong>Teradata</strong> T<strong>Pump</strong> utility on <strong>Teradata</strong> <strong>Data</strong>base for UNIX and Windows with a UNIXstyle<br />
command format.<br />
The rules for invoking <strong>Teradata</strong> T<strong>Pump</strong> under UNIX are the same as for IBM mainframe<br />
client-based systems described in the preceding section. The difference lies in UNIX syntax.<br />
The Windows syntax and the UNIX syntax are essentially the same, the main difference being<br />
that single quotes should be used on UNIX systems and double quotes should be used on<br />
Windows systems.<br />
To invoke <strong>Teradata</strong> T<strong>Pump</strong> in interactive mode, enter tpump at the system command prompt:<br />
tpump<br />
<strong>Teradata</strong> T<strong>Pump</strong> displays the following message to begin the interactive session:<br />
========================================================================<br />
= =<br />
= <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Utility Release 13.10.00.000 =<br />
= Platform WIN32 =<br />
= =<br />
========================================================================<br />
= =<br />
= Copyright 1997-2010 <strong>Teradata</strong> Corporation. ALL RIGHTS RESERVED. =<br />
= =<br />
========================================================================<br />
**** 11:54:53 UTY2411 Processing start date: WED NOV 18, 2009<br />
========================================================================<br />
42 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
= =<br />
= Logon/Connection =<br />
= =<br />
========================================================================<br />
Batch Mode<br />
This section covers invoking <strong>Teradata</strong> T<strong>Pump</strong> in batch mode on network-attached and<br />
channel-attached systems.<br />
For a description of how to read the syntax diagrams used in this book, see Appendix A: “How<br />
to Read Syntax Diagrams.”<br />
Batch Mode on Network-attached UNIX Systems<br />
Refer to the runtime parameter descriptions in Table 12 on page 45 and use the following<br />
syntax to invoke <strong>Teradata</strong> T<strong>Pump</strong> on network-attached UNIX client systems:<br />
tpump<br />
-b<br />
c charactersetname<br />
-C filename<br />
-d periodicityvalue<br />
-e errorfilename<br />
-f numberofbuffers<br />
-m<br />
-r 'tpump command'<br />
-v<br />
-y<br />
-i scriptencoding<br />
-u outputencoding<br />
-t nn<br />
-V<br />
< infilename > outfilename<br />
3021E016<br />
Batch Mode on Network-attached Windows Systems<br />
Refer to the runtime parameter descriptions in Table 12 on page 45 and use the following<br />
syntax to invoke <strong>Teradata</strong> T<strong>Pump</strong> on network-attached Windows client systems:<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 43
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
tpump<br />
-b<br />
-c charactersetname<br />
-C filename<br />
-d periodicityvalue<br />
-e errorfilename<br />
-f numberofbuffers<br />
-m<br />
-r "tpumpcommand"<br />
-v<br />
-y<br />
-i scriptencoding<br />
-u outputencoding<br />
-t nn<br />
-V<br />
< infilename > outfilename<br />
3021E015<br />
Note: The Windows syntax is essentially the same as the UNIX system, the main difference<br />
being that single quotes should be used on UNIX systems and double quotes should be used<br />
on Windows systems.<br />
Batch Mode on Channel-attached z/OS Systems<br />
Refer to the runtime parameter descriptions in Table 12 on page 45 and use the following<br />
syntax to invoke <strong>Teradata</strong> T<strong>Pump</strong> on channel-attached z/OS client systems.<br />
// EXEC TDSTPUMP<br />
PARM = , BRIEF<br />
,<br />
BUFFERS = numberofbuffers<br />
CHARSET = charactersetname<br />
CONFIG = filename<br />
ERRLOG = filename<br />
MACROS<br />
PRDICITY = periodicityvalue<br />
VERBOSE<br />
'tpump command'<br />
RTYTIMES = nn<br />
RVERSION<br />
3021D014<br />
Run-time Parameters<br />
Table 12 describes the run-time parameters used by <strong>Teradata</strong> T<strong>Pump</strong> on channel-attached and<br />
network-attached systems.<br />
44 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
Table 12: Run-time Parameters/Systems<br />
Channel-attached Network-attached Description<br />
BRIEF -b Specifies reduced print output, which limits <strong>Teradata</strong><br />
T<strong>Pump</strong> printout to the minimal information required to<br />
determine the success of the job:<br />
• Header information<br />
• Logon/logoff information<br />
• Candidate records<br />
• Insert, update, and delete results<br />
• Error table counts<br />
BUFFERS =<br />
numberofbuffers<br />
CHARSET =<br />
charactersetname<br />
-f numberofbuffers Sets the number of request buffers.<br />
For <strong>Teradata</strong> Tools and Utilities 06.02.00 and earlier, the<br />
buffers runtime parameter can be set from 2 to a<br />
maximum of 10. The default value is 2.<br />
Beginning with <strong>Teradata</strong> Tools and Utilities 06.02.00.01,<br />
the buffers runtime parameter can be set with a lower<br />
limit of 2 and no upper limit. The default value is 3.<br />
The maximum number of request buffers that may be<br />
allocated is BUFFERS * session_count.<br />
Beginning with <strong>Teradata</strong> Tools and Utilities 06.02.00.01,<br />
request buffers are a global resource, so buffers are<br />
assigned to any session as needed, and then returned to a<br />
free pool. At any point in time, the number of request<br />
buffers assigned to a session can vary from zero to<br />
BUFFERS * session_count.<br />
Prior to <strong>Teradata</strong> Tools and Utilities 06.02.00.01, a request<br />
buffer was permanently owned by the session to which it<br />
was first assigned, and so could not be used by any other<br />
session. The maximum number of requests buffers that a<br />
session could own was determined by the value of<br />
BUFFERS.<br />
-c charactersetname Defines a character set for the <strong>Teradata</strong> T<strong>Pump</strong> job.<br />
The character set specification remains in effect for the<br />
entire <strong>Teradata</strong> T<strong>Pump</strong> job, even if the <strong>Teradata</strong> <strong>Data</strong>base<br />
server resets, causing the <strong>Teradata</strong> T<strong>Pump</strong> job to be<br />
restarted.<br />
Note: The character set specification does not remain in<br />
effect if the client system fails, or if the <strong>Teradata</strong> T<strong>Pump</strong><br />
job is canceled. In these cases, when the job is<br />
resubmitted, the job must use the same character set<br />
specification that was used on the initial job. If a different<br />
character set specification is used when such a job is<br />
resubmitted, the data loaded by the restarted job will not<br />
appear the same as the data loaded by the initial job.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 45
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
Table 12: Run-time Parameters/Systems (continued)<br />
Channel-attached Network-attached Description<br />
If a character set specification is not entered, the default is<br />
whatever character set that is specified for <strong>Teradata</strong><br />
<strong>Data</strong>base when <strong>Teradata</strong> T<strong>Pump</strong> was invoked.<br />
Note: See Client Character Sets in Chapter 1 for more<br />
information on supported character sets.<br />
When using a UTF-16 client character set on the network<br />
or UTF-8 client character set on the mainframe, specify<br />
the client character set name by the runtime parameter<br />
(that is, "-c" on the network and "CHARSET" on the<br />
mainframe.)<br />
Not Applicable -i scriptencoding Specifies the encoding form of the job script. If this<br />
parameter is not specified and the client character set is<br />
UTF-16, <strong>Teradata</strong> T<strong>Pump</strong> interprets the job script to<br />
UTF-16. If character-type data is also specified in the<br />
script, <strong>Teradata</strong> T<strong>Pump</strong> converts the string literals and the<br />
corresponding field in the import data to the same<br />
character set before comparing or concatenating them.<br />
(String literals are specified with .APPLY…WHERE….;<br />
LAYOUT…CONTINUEIF….; FIELD…NULLIF…;<br />
FIELD…||…commands.)<br />
Valid encoding options are:<br />
• UTF-8 or UTF8<br />
• UTF-16BE, or UTF16BE, or UTF16-BE<br />
• UTF-16LE, or UTF16LE, or UTF16-LE<br />
• UTF-16 or UTF16<br />
The specified encoding character set applies to all script<br />
files included by the .RUN FILE commands.<br />
The UTF-16 or UTF 8 Byte Order Mark (BOM) can be<br />
present or absent in the script file.<br />
When UTF-16 BOM is present and 'UTF-16' is<br />
specified, <strong>Teradata</strong> T<strong>Pump</strong> interprets the script according<br />
to the endianness indicated by the UTF-16 BOM. When<br />
the UTF-16 BOM is not present, <strong>Teradata</strong> T<strong>Pump</strong><br />
interprets the script according to the endianness indicated<br />
by the encoding option.<br />
Not Applicable -u outputencoding Specifies the encoding form of the job output. The<br />
parameter is valid only when the UTF-16 client character<br />
set is used.<br />
When this parameter is used, it should be placed in front<br />
of other runtime parameters to ensure the whole job<br />
output is printed in the desired encoding form.<br />
46 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
Table 12: Run-time Parameters/Systems (continued)<br />
Channel-attached Network-attached Description<br />
If is not placed ahead of other runtime parameters when<br />
invoking the job, a warning message will be printed.<br />
Available output encoding options are:<br />
• UTF-16BE, or UTF16BE, or UTF16-BE<br />
• UTF-16LE, or UTF16LE, or UTF16-LE<br />
• UTF-16 or UTF16<br />
UTF-16BE instructs <strong>Teradata</strong> T<strong>Pump</strong> to print the job<br />
output in big endian UTF-16 encoding scheme.<br />
UTF-LE instructs <strong>Teradata</strong> T<strong>Pump</strong> to print the job<br />
output in little endian UTF-16 encoding scheme. On big<br />
endian client systems, UTF-16 instructs <strong>Teradata</strong> T<strong>Pump</strong><br />
to print the job output in big endian UTF-16 encoding<br />
scheme. On little endian client systems, UTF-16 instructs<br />
<strong>Teradata</strong> T<strong>Pump</strong> to print the job output in little endian<br />
UTF-16 encoding scheme.<br />
The UTF-16 BOM is not printed as a part of job output.<br />
When this parameter is not specified and the client<br />
character set is UTF-16, if <strong>Teradata</strong> T<strong>Pump</strong> output needs<br />
to be redirected to a log file on network platforms, “-u<br />
outputencoding” must be specified.<br />
CONFIG =<br />
filename<br />
-C filename Specifies the configuration file for the <strong>Teradata</strong> T<strong>Pump</strong><br />
job. The configuration file contains various configuration<br />
and tuning parameters for <strong>Teradata</strong> T<strong>Pump</strong>. The<br />
particular usefulness of this file is for values that:<br />
• are site- or host-specific<br />
• script that developers may not necessarily be aware of<br />
• will likely change independently of <strong>Teradata</strong> T<strong>Pump</strong><br />
scripts.<br />
The installation of <strong>Teradata</strong> T<strong>Pump</strong> installs a default<br />
configuration file. On UNIX, it also installs a shell script<br />
that calls <strong>Teradata</strong> T<strong>Pump</strong> using the default configuration<br />
file on the command line.<br />
The format of the entries in the file is:<br />
<br />
• Lines in the file that do not begin with a valid keyword<br />
are ignored.<br />
• Keywords are case insensitive.<br />
• On UNIX systems, this file is called tdatpump.cfg and<br />
is expected to be found in the directory /usr/lib.<br />
• If the configuration file is not found, the program<br />
issues a warning message and uses the default values<br />
wherever necessary.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 47
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
Table 12: Run-time Parameters/Systems (continued)<br />
Channel-attached Network-attached Description<br />
At this time, the only valid keyword is INMEMSORT,<br />
which is an integer data type containing the maximum<br />
number of bytes that can be sorted in memory. <strong>Teradata</strong><br />
T<strong>Pump</strong> recovery logic uses this value. This keyword can<br />
be modified to increase the amount of memory available<br />
for sorting.<br />
If this keyword is not provided in the configuration file,<br />
or the configuration file is not provided, the default value<br />
for INMEMSORT is 6,000,000 for UNIX, 12,000,000 for<br />
z/OS, and 3,000,000 for Windows.<br />
PRDICITY<br />
periodicityvalue<br />
ERRLOG=<br />
error filename<br />
-d periodicityvalue Specifies to change the periodicity value to control the<br />
rate at which statements are transferred to the database.<br />
This parameter may be adjusted to improve the <strong>Teradata</strong><br />
T<strong>Pump</strong> workflow.<br />
This parameter is in effect whenever the BEGIN LOAD<br />
command uses the RATE parameter to control the rate<br />
that statements are sent to the database. The default<br />
periodicity value is four 15-second periods per minute.<br />
The periodicityvalue variable contains a value between 1<br />
and 600, which is the value range for the number of<br />
periods specified. The default value is 4.<br />
Alternatively, periodicity can be changed by executing the<br />
T<strong>Pump</strong>Macro.UserUpdateSelect macro (provided with<br />
<strong>Teradata</strong> T<strong>Pump</strong> Monitor SQL scripts) to update the<br />
monitor interface table while the job is running.<br />
-e errorfilename Specifies to use the error logging function. Using this<br />
parameter creates an alternate error log file to hold<br />
messages generated by <strong>Teradata</strong> T<strong>Pump</strong>. Specifying an<br />
alternate file name produces a duplicate record of all<br />
<strong>Teradata</strong> T<strong>Pump</strong> error messages. This allows any errors<br />
detected to be examined without having to go through<br />
the entire output stream.<br />
The errorfilename defined is the location where error<br />
messages are copied. Directory identifiers can also be<br />
included in the file names defined.<br />
On UNIX, the maximum length of the file name depends<br />
on the UNIX version currently in use.<br />
On channel-attached client systems, the alternate file<br />
specification is limited to eight characters , and on z/OS,<br />
it must be to a DD name defined in the JCL.<br />
Note: If the file names defined already exist, they are<br />
overwritten. Otherwise, they are automatically created.<br />
There is no default error log errorfilename specification.<br />
48 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
Table 12: Run-time Parameters/Systems (continued)<br />
Channel-attached Network-attached Description<br />
MACROS -m Invocation option to tell <strong>Teradata</strong> T<strong>Pump</strong> to keep macros<br />
that were created during the job run. These macros can be<br />
used as predefined macros for the same job.<br />
In order to use the same script after the -m parameter is<br />
used in the previous run, the EXECMACRO command<br />
must be added to the script.<br />
To avoid duplicate macro names, a random number from<br />
1 to 99 is used in each macro name when the NAME<br />
command is not used. The format in which the macro is<br />
created is:<br />
MYYYYMMDD_HHMMSS_LLLLL_DDD_SSS<br />
where<br />
• LLLLL is the low-order 5 digit of the logon sequence<br />
returned by the database from the .LOGON<br />
command.<br />
• DDD is the .DML sequence (ordinal) number. This<br />
value is not reset to one for successive loads (.BEGIN<br />
LOAD) in a single job, but continues to be<br />
incremented.<br />
• SSS is the SQL statement sequence (ordinal) number<br />
within the .DML group.<br />
RTYTIMES=nn -t nn Specification for retry times. The default for nn is 16. If<br />
nn = 0, retry times will be set back to 16.<br />
The retry times options in the BEGIN LOAD can override<br />
this option for the requests/data sent between "BEGIN<br />
LOAD" and "END LOAD" pair.<br />
'tpump command'<br />
-r 'tpump<br />
command'<br />
Invocation option that can signify the start of a <strong>Teradata</strong><br />
T<strong>Pump</strong> job. This is usually a RUN FILE command<br />
specifying the file containing the <strong>Teradata</strong> T<strong>Pump</strong> job<br />
script because only one <strong>Teradata</strong> T<strong>Pump</strong> command may<br />
be specified. For example, on UNIX:<br />
'.RUN FILE tpump.script;'<br />
VERBOSE -v Specifies to turn on verbose mode. Using this parameter<br />
provides additional statistical data in addition to the<br />
regular statistics.<br />
In verbose mode, the input file from which statistics are<br />
normally displayed includes such additional statistics as<br />
the number of database requests sent, in addition to the<br />
normal number of requests.<br />
Note: In verbose mode, <strong>Teradata</strong> T<strong>Pump</strong> displays each<br />
retryable error when it occurred.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 49
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
Table 12: Run-time Parameters/Systems (continued)<br />
Channel-attached Network-attached Description<br />
Not Applicable -y Specification for the data encryption option. When<br />
specified, data and requests will be encrypted in all<br />
sessions used by the job.<br />
The encryption options in the BEGIN LOAD or the<br />
PARTITION commands can override this option for the<br />
sessions associated with those commands<br />
Not Applicable < infilename Name of the standard input file containing the <strong>Teradata</strong><br />
T<strong>Pump</strong> commands and <strong>Teradata</strong> SQL statements. The<br />
infilename specification redirects the standard input<br />
(stdin). If an infilename specification is not entered, the<br />
default is stdin. If end-of-file is reached on the specified<br />
input file, the input does not refer to stdin and the job<br />
terminates.<br />
Note: On channel-attached client systems, the DD<br />
control statement must be used to specify the input file<br />
before <strong>Teradata</strong> T<strong>Pump</strong> is invoked.<br />
Not Applicable > outfilename Name of the standard output file for <strong>Teradata</strong> T<strong>Pump</strong><br />
messages. The outfilename specification redirects the<br />
standard output (stdout). If an outfilename specification<br />
is not entered, the default is stdout.<br />
Note: If an outfilename specification is used to redirect<br />
stdout, do not use the same outfilename as an output or<br />
echo destination in the DISPLAY or ROUTE commands.<br />
Doing so produces incomplete results because of the<br />
conflicting write operations to the same file.<br />
Note: On channel-attached client systems, the DD<br />
control statement must be used to specify the output file<br />
before the utility is invoked.<br />
RVERSION -V Display version number and stop.<br />
Note: See the invocation examples in Appendix B: “<strong>Teradata</strong> T<strong>Pump</strong> Examples” for sample<br />
JCL listings, commands, and output samples for the invocation options.<br />
Examples - Redirection of Inputs and Outputs<br />
The following examples show various ways to redirect stdin and stdout via UNIX.<br />
Example 1<br />
This example specifies both an input file and an output file. The <strong>Teradata</strong> T<strong>Pump</strong> script is in<br />
/home/tpuser/tests/test1 and the job output is written to /home/tpuser/tests/out1.<br />
tpump /home/tpuser/tests/out1<br />
50 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Terminating <strong>Teradata</strong> T<strong>Pump</strong><br />
Example 2<br />
This example specifies only an input file. The <strong>Teradata</strong> T<strong>Pump</strong> script is in /home/tpuser/tests/<br />
test1 and the job output is written to stdout, which ordinarily would be the terminal.<br />
T<strong>Pump</strong>tpump /home/tpuser/tests/out1<br />
Example 4<br />
This example specifies neither an input nor an output file. <strong>Teradata</strong> T<strong>Pump</strong> commands are<br />
typed at a terminal via stdin and job output is written to the terminal via stdout.<br />
tpump<br />
Terminating <strong>Teradata</strong> T<strong>Pump</strong><br />
Normal Termination<br />
This section covers methods of termination and other topics related to terminating <strong>Teradata</strong><br />
T<strong>Pump</strong>.<br />
There are two ways to terminate <strong>Teradata</strong> T<strong>Pump</strong>:<br />
• Normal termination<br />
• Abort termination<br />
Use the <strong>Teradata</strong> T<strong>Pump</strong> LOGOFF command in the <strong>Teradata</strong> T<strong>Pump</strong> job script to terminate<br />
the utility normally on both network- and channel-attached client systems:<br />
.LOGOFF<br />
retcode<br />
;<br />
HE03A003<br />
<strong>Teradata</strong> T<strong>Pump</strong> logs off all sessions with <strong>Teradata</strong> <strong>Data</strong>base and returns a status message<br />
indicating:<br />
• The total processor time that was used<br />
• The job start and stop date/time<br />
• The highest return code that was encountered:<br />
• 0 if the job completed normally<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 51
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Restart and Recovery<br />
Abort Termination<br />
• 4 if a warning condition occurred<br />
• 8 if a user error occurred<br />
• 12 if a fatal error occurred<br />
• 16 if no message destination is available<br />
<strong>Teradata</strong> T<strong>Pump</strong> also:<br />
• Maintains or drops the restart log table, depending on the success or failure of the job.<br />
• If specified, <strong>Teradata</strong> T<strong>Pump</strong> returns the optional retcode value to the client operating<br />
system.<br />
See the LOGON command description in Chapter 3 for more information about return codes<br />
and the conditions that maintain or drop the restart log table.<br />
The procedure for aborting a <strong>Teradata</strong> T<strong>Pump</strong> job depends on whether the utility is running<br />
on a network-attached or a channel-attached client system:<br />
To abort a <strong>Teradata</strong> T<strong>Pump</strong> job running on a channel-attached client system<br />
✔ Cancel the job from the client system console.<br />
To abort a <strong>Teradata</strong> T<strong>Pump</strong> job running on a network-attached client system<br />
✔ Press the Control + C key combination three times on the workstation keyboard.<br />
After Terminating a <strong>Teradata</strong> T<strong>Pump</strong> Job<br />
After terminating a <strong>Teradata</strong> T<strong>Pump</strong> job:<br />
• Restart the job and allow it to run to completion<br />
• Reinitialize the job and run it to completion<br />
• Abandon the job and clean up the database objects.<br />
For more information on how to perform the above options, see “Restart and Recovery.”.<br />
Restart and Recovery<br />
This section explains <strong>Teradata</strong> T<strong>Pump</strong>’s handling of restart and recovery operations in the<br />
event of a system failure.<br />
The <strong>Teradata</strong> T<strong>Pump</strong> facility includes a number of features that enable recovery from client or<br />
<strong>Teradata</strong> <strong>Data</strong>base failure, with minimal requirements for job resubmission or continuation.<br />
Upon restart or resubmission, <strong>Teradata</strong> T<strong>Pump</strong> interrogates the restart log table on <strong>Teradata</strong><br />
<strong>Data</strong>base and resumes operations from where it had left off.<br />
52 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Restart and Recovery<br />
Caution:<br />
Do not tamper with the contents of the restart log table. A missing or altered restart log table<br />
will cause the <strong>Teradata</strong> T<strong>Pump</strong> job to be recovered incorrectly.<br />
Basic <strong>Teradata</strong> T<strong>Pump</strong> Recovery<br />
Whenever a database restart is detected or a <strong>Teradata</strong> T<strong>Pump</strong> job is restarted on the host<br />
system, the following activity occurs:<br />
• The restart log table is scanned with reference to the <strong>Teradata</strong> T<strong>Pump</strong> script. Each<br />
statement within the script is either executed because a row does not exist or ignored<br />
because a row exists in the restart log.<br />
• In the case of the END LOAD statement, there are a number of rows which are placed in<br />
the restart log table which let <strong>Teradata</strong> T<strong>Pump</strong> decide what to do. <strong>Teradata</strong> T<strong>Pump</strong> ignores<br />
any complete IMPORT within a LOAD and begins at the incomplete IMPORT.<br />
• Within an unfinished IMPORT, <strong>Teradata</strong> T<strong>Pump</strong> begins processing at the last complete<br />
checkpoint. If the <strong>Teradata</strong> T<strong>Pump</strong> job was running in SIMPLE mode before the restart,<br />
then recovery is complete and processing continues at the last complete checkpoint.<br />
• If <strong>Teradata</strong> T<strong>Pump</strong> was running in ROBUST mode before it was restarted, then <strong>Teradata</strong><br />
T<strong>Pump</strong> must next ascertain how much processing has been completed since the last<br />
checkpoint. This is accomplished by reading back a set of “Partial Checkpoints” from the<br />
restart log table in <strong>Teradata</strong> <strong>Data</strong>base, sorting them, and then reprocessing all transactions<br />
which were left incomplete when the job was interrupted.<br />
Protection and Location of <strong>Teradata</strong> T<strong>Pump</strong> <strong>Data</strong>base Objects<br />
The restart log table is critical to the recovery process. If the restart log table is dropped, there<br />
is no way to recover an interrupted <strong>Teradata</strong> T<strong>Pump</strong> job.<br />
In addition to the restart log table, <strong>Teradata</strong> T<strong>Pump</strong> also creates an error table and a number<br />
of macros (where each macro corresponds to a DML SQL statement involved in current<br />
IMPORT). If these database objects are dropped, they can, with some effort, being recreated.<br />
However, it is much more convenient for this NOT to be necessary.<br />
<strong>Teradata</strong> T<strong>Pump</strong> does not have special locks that it places on database objects. It is important<br />
that administrators take security precautions to avoid the loss of these objects.<br />
If the objects are dropped accidentally, the following information should allow an<br />
administrator to recreate them.<br />
<strong>Teradata</strong> T<strong>Pump</strong> macros are placed in the same database that contains the log restart table.<br />
The macros are named according to the following convention:<br />
Jobname_DDD_SSS<br />
where<br />
• Jobname is the job name, which, if not explicitly specified, defaults to:<br />
MYYYYMMDD_HHMMSS_LLLLL.<br />
• LLLLL is the low-order 5 digits of the logon sequence number returned by the database<br />
from the .LOGON command.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 53
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Restart and Recovery<br />
• DDD is the number of the .DML sequence (ordinal) number. This value is not reset to one<br />
for successive loads (.BEGIN LOAD) in a single job, but continues to be incremented.<br />
• SSS is the SQL statements sequence (ordinal) number within the .DML group.<br />
Thus, given the following script fragment:<br />
.LOGTABLE LT_SIGH;<br />
.LOGON TDPID/CME,CME;<br />
...<br />
.LAYOUT LAY1A<br />
...<br />
.DML LABEL TAB1PART1;<br />
INSERT into tab1 values (:F0,:F1,:F2,:F3);<br />
.DML LABEL TAB2PART1;<br />
INSERT into tab2 values (:F0,:F1,:F2,:F3);<br />
...<br />
.IMPORT INFILE TPDAT<br />
LAYOUT LAY1A<br />
APPLY TAB1PART1<br />
APPLY TAB2PART1;<br />
and assuming the job name is defaulted, the macros are named:<br />
M20020530_171209_06222_001_001 and M20020530_171209_06222_002_001.<br />
The contents of a <strong>Teradata</strong> T<strong>Pump</strong> macro is taken directly from the script and consists of a<br />
parameter clause derived from the LAYOUT and the actual statement which is specified in the<br />
script. Continuing the example above, if the LAYOUT associated with the statement is as<br />
follows:<br />
.LAYOUT LAY1A;<br />
.FIELD F0 * integer key;<br />
.FIELD F1 * integer;<br />
.FIELD F2 * integer;<br />
.FILLER FX * integer;<br />
.FIELD F3 * char(38);<br />
then the macros will be created as follows:<br />
CREATE MACRO CME.M20020530_171209_06222_001_001 (<br />
F0 (INTEGER), F1 (INTEGER), F2 (INTEGER), F3 (CHAR(38))<br />
) AS (INSERT INTO TAB1 VALUES(:F0, :F1, :F2, :F3);<br />
);<br />
CREATE MACRO CME.M20020530_171209_06222_002_001 (<br />
F0 (INTEGER), F1 (INTEGER), F2 (INTEGER), F3 (CHAR(38))<br />
) AS ( INSERT INTO TAB2 VALUES(:F0, :F1, :F2, :F3);<br />
);<br />
Note that the actual names of the parameters in the parameter list are not important; however,<br />
what is important is that the types of the parameters are specified in the macro in exactly the<br />
same order as the types in the LAYOUT. Also important is the fact that FILLER fields are not<br />
included in the parameter list since they are stripped out by <strong>Teradata</strong> T<strong>Pump</strong>.<br />
The error table, if it is not explicitly specified, is:<br />
_nnn_ET<br />
Where nnn is the load sequence number.<br />
54 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Restart and Recovery<br />
If the database for the error table is not explicit in the script, the table is placed in the database<br />
associated with the <strong>Teradata</strong> T<strong>Pump</strong> user logon, unless the DATABASE command has been<br />
issued.<br />
Continuing the above example, assuming the user defaults the error table, then the create table<br />
command for it will be:<br />
CREATE SET TABLE M20020530_171209_06222_001_ET,<br />
NO BEFORE JOURNAL,<br />
NO AFTER JOURNAL<br />
(<br />
ImportSeq BYTEINT,<br />
DMLSeq BYTEINT,<br />
SMTSeq BYTEINT,<br />
ApplySeq BYTEINT,<br />
sourceseq INTEGER,<br />
<strong>Data</strong>Seq BYTEINT,<br />
ErrorCode INTEGER,<br />
ErrorMsg VARCHAR(255) CHARACTER SET UNICODE NOT CASESPECIFIC,<br />
ErrorField SMALLINT,<br />
Host<strong>Data</strong> VARBYTE(63677))<br />
UNIQUE PRIMARY INDEX ( ImportSeq ,DMLSeq ,SMTSeq ,ApplySeq ,sourceseq ,<br />
<strong>Data</strong>Seq );<br />
Reinitialize a <strong>Teradata</strong> T<strong>Pump</strong> Job<br />
If the restart log table has been accidentally dropped or corrupted for a <strong>Teradata</strong> T<strong>Pump</strong> job,<br />
reinitialize the job using the following procedure:<br />
Reinitialize a <strong>Teradata</strong> T<strong>Pump</strong> Job<br />
1 Determine how much of the job has completed in order to take data out of the <strong>Teradata</strong><br />
T<strong>Pump</strong> input data set.<br />
How this is done will depend on the table and procedures involved with table<br />
maintenance. This will vary between jobs and with the procedures in effect at each<br />
customer site.<br />
2 Delete any database objects associated with the <strong>Teradata</strong> T<strong>Pump</strong> job that may exist. This<br />
cleans up <strong>Teradata</strong> T<strong>Pump</strong>.<br />
These objects include the error table and any DML-associated macros. Directions for<br />
finding these objects are provided in the previous section.<br />
Recover an Aborted <strong>Teradata</strong> T<strong>Pump</strong> Job<br />
An aborted <strong>Teradata</strong> T<strong>Pump</strong> job is one that has been terminated early for any number of<br />
reasons (out of database space, accidental cancellation by mainframe operators, UNIX kernel<br />
panic, error limit in the <strong>Teradata</strong> T<strong>Pump</strong> job exceeded, and so on) and all <strong>Teradata</strong> T<strong>Pump</strong><br />
database objects, the restart log table, the error table, and DML macros are intact.<br />
An aborted <strong>Teradata</strong> T<strong>Pump</strong> job may be restarted using the same job script that was used in<br />
the original job, and <strong>Teradata</strong> T<strong>Pump</strong> will perform the recovery of the job.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 55
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
Recover from Script Errors<br />
When <strong>Teradata</strong> T<strong>Pump</strong> encounters an error in the input script, a diagnostic message is<br />
generated and the operation is stopped with a non-zero return code. The script can modify<br />
and correct the faulty code, and resubmit the job. Operations begin with the statement<br />
following the last one that was successfully completed.<br />
Program Considerations<br />
This section provides information to help applications programmers to design and script<br />
<strong>Teradata</strong> T<strong>Pump</strong> jobs. Additional information needed by programmers and/or system<br />
administrators includes space requirements, locks, and the use of fallback or nonfallback<br />
tables.<br />
The information in this section includes <strong>Teradata</strong> T<strong>Pump</strong> command conventions, variables,<br />
and ANSI/SQL DateTime <strong>Data</strong> types. Information related to using comments, specifying a<br />
character set, using graphic data types, and using graphic constants is found in this section.<br />
Restrictions and limitations, as well as termination return codes, are covered as well.<br />
<strong>Teradata</strong> T<strong>Pump</strong> Command Conventions<br />
The following command conventions apply when using <strong>Teradata</strong> T<strong>Pump</strong>.<br />
<strong>Teradata</strong> T<strong>Pump</strong> Reserved Words<br />
Commands supported by <strong>Teradata</strong> T<strong>Pump</strong> do not use reserved words (or keywords), except<br />
those that are operators, and only where an expression is allowed. Although there is no official<br />
restriction against the use of <strong>Teradata</strong> T<strong>Pump</strong> reserved words as variable names, it is strongly<br />
recommended to avoid their use, as well as the use of <strong>Teradata</strong> SQL reserved words. Avoid<br />
words which are operators (see Table 13). Their use can result in ambiguous expressions.<br />
Table 13 contains a list of <strong>Teradata</strong> T<strong>Pump</strong> Operators.<br />
Table 13: <strong>Teradata</strong> T<strong>Pump</strong> Operators<br />
Commands<br />
AND BETWEEN EQ<br />
GE GT IN<br />
IS LE LIKE<br />
LT MOD NE<br />
NOT NULL OR<br />
<strong>Teradata</strong> SQL Reserved Words<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports a subset of <strong>Teradata</strong> SQL listed in Table 25 on page 92. The subset<br />
of <strong>Teradata</strong> SQL consists only of statements beginning with one of the reserved words (or<br />
56 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
keywords) in Table 1. Avoid the use of the <strong>Teradata</strong> SQL reserved words listed in <strong>Teradata</strong><br />
T<strong>Pump</strong> commands.<br />
Conditional Expressions<br />
Some of the commands described in this chapter use conditional expressions. If they evaluate<br />
to true, conditional expressions return a result of 1; if false, they return a result of 0.<br />
Table 14 contains a list of <strong>Teradata</strong> T<strong>Pump</strong> Conditional Expressions.<br />
Table 14: <strong>Teradata</strong> T<strong>Pump</strong> Conditional Expressions<br />
Commands<br />
+ - / MOD NOT<br />
|| IS NOT NULL IS NULL EQ<br />
= NE ^=<br />
NOT= ~= GE >=<br />
GT > LE
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
The logged on user must have the appropriate user privileges on the tables. At the time the<br />
BEGIN LOAD is initiated, SELECT privileges, as well as INSERT, UPDATE, and DELETE<br />
privileges are required, depending on the DML statements specified in the current task.<br />
Privileges must follow standard <strong>Teradata</strong> privilege rules. The kind of privilege required<br />
depends on the kind of DML statements to be applied. <strong>Teradata</strong> T<strong>Pump</strong> tasks require that the<br />
target table is owned or access is available. Additional privilege for the target table is required,<br />
depending on the DML command, INSERT, UPDATE, or DELETE. The additional privilege is<br />
described for each statement type in later sections. No matter what kind of statement,<br />
CREATE TABLE privilege on the databases where the error tables are going to be placed.<br />
CREATE TABLE privilege for <strong>Teradata</strong> T<strong>Pump</strong> to create a restart log table is also required. If<br />
the restart log table specified for the support environment already exists, INSERT and<br />
UPDATE privileges on the table are required.<br />
In a <strong>Teradata</strong> T<strong>Pump</strong> task, it is possible for more than one statement/data record combination<br />
to affect a single row. If application of any statement/data record combination to a row would<br />
produce an error, it is not applied, but all prior and subsequent error-free combinations<br />
affecting the same row or other rows are applied.<br />
<strong>Teradata</strong> T<strong>Pump</strong> can guarantee the order of operations on a given row via the correct use of<br />
the serialize option to specify the primary index of a given target table. When serialize is used,<br />
operations for a given set of rows occurs in order on one session. Without serialize, statements<br />
are executed on the first session available; hence, operations may occur out of order.<br />
Assuming that the serialize option is in effect, note that the order in which DML statement or<br />
host record pairings are applied to a given target row is totally deterministic; so too is the<br />
order in which rows are applied to the target rows. Operations occur in exactly the same order<br />
as they are read from the data source and, if there are multiple apply clauses, in order by apply<br />
clause from first to last.<br />
In addition to using serialize option in the BEGIN LOAD command, the SERIALIZEON<br />
keyword can also be specified in the DML command, which lets serialization be turned on for<br />
the fields specified. The SERIALIZEON keyword can be used in the DML command with the<br />
SERIALIZE keyword in the BEGIN LOAD command. When this is done, the DML-level<br />
serialization ignores and overrides the BEGIN LOAD-level serialization. In this case, the DML<br />
command with the serialization option in effect will be serialized on the fields specified.<br />
Operations generated from the first IMPORT statement take place before operations<br />
generated from the second IMPORT.<br />
Variables<br />
This section contains information about the variables used in <strong>Teradata</strong> T<strong>Pump</strong>.<br />
Predefined System Variables<br />
Avoid use of the prefix &SYS in user-defined symbols because the names of predefined utility<br />
variables begin with the prefix. Table 15 contains a list of predefined system variables.<br />
58 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
Table 15: Predefined System Variables<br />
System Variable<br />
&SYSDATE<br />
&SYSDATE4<br />
&SYSDAY<br />
&SYSDELCNT[n}<br />
&SYSETCNT[n}<br />
&SYSINSCNT[n}<br />
&SYSJOBNAME<br />
&SYSOS<br />
&SYSRC<br />
&SYSRCDCNT[n]<br />
Description<br />
8-character date format yy/mm/dd<br />
10-character date format yyyy/mm/dd<br />
3-character day of week: MON TUE WED THU FRI SAT SUN<br />
Number of rows deleted from all the target tables of Import n. If n is not<br />
specified, it gives the count of deletes done to all the target tables for all<br />
imports. The maximum value of n is 4.<br />
Number of records inserted into the error table for import n. If n is not<br />
specified, it gives the total count of all the records inserted into the error<br />
table for all imports. The maximum value of n is 4.<br />
Number of rows inserted into all the target tables for import n. If n is not<br />
specified, this variable gives the total inserts done to all the target tables<br />
for all imports. The maximum value of n is 4.<br />
Up to 16 characters (ASCII or EBCDIC) in length, in whichever<br />
character set is appropriate.<br />
If &SYSJOBNAME is not set using the NAME command, it defaults to<br />
MYYYYMMDD_hhmmss_lllll, where<br />
M = macro<br />
YYYY = year<br />
MM = month<br />
DD = day<br />
hh = hour<br />
mm = minute<br />
ss = second<br />
lllll = is the low-order 5 digits of the logon sequence number returned by<br />
the database from the .LOGON command.<br />
Client operating system:<br />
• UNIX<br />
• HP-UX<br />
• IBM-AIX<br />
• Win32<br />
• Linux<br />
• For z/OS:<br />
VS1<br />
z/OS<br />
z/OS /SP<br />
z/OS /ESA<br />
Completion code from last response by <strong>Teradata</strong> <strong>Data</strong>base.<br />
Total number of records read for import n. If n is not specified, it gives<br />
the total records read for all imports.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 59
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
Table 15: Predefined System Variables (continued)<br />
System Variable<br />
&SYSTIME<br />
&SYSUPDCNT[n]<br />
&SYSUSER<br />
&SYSAPLYCNT[n]<br />
&SYSNOAPLYCNT[n]<br />
&SYSRJCTCNT[n]<br />
Description<br />
8-character time format hh:mm:ss<br />
Gives total updates to all target tables for import n. If n is not given, it<br />
gives the total updates done to all the target tables for all the imports.<br />
The maximum value of n is 4.<br />
Client system dependent: CMS user ID, z/OS Batch user ID. (z/OS-batch<br />
returns user ID only when a security package such as RACF, ACF2, or<br />
Top Secret has been installed).<br />
Number of records applied for import n. If n is not given, it gives the<br />
total number of records applied for all imports.<br />
Number of records not applied for import n. If n is not given, it gives the<br />
total number of records not applied for all imports.<br />
Number of records rejected for import n. If n is not given, it gives the<br />
total number of rejected records of all the imports. The maximum value<br />
of n is 4.<br />
Date and Time Variables<br />
&SYSDATE, &SYSDATE4, &SYSTIME, and &SYSDAY reflect the time when <strong>Teradata</strong> T<strong>Pump</strong><br />
begins execution. The original values are restored at restart. These values are character data<br />
types and should not be used in numeric operations. System variables cannot be modified,<br />
only referenced.<br />
The values returned by &SYSDAY are all in upper case. Monday, for example, is returned as<br />
'MON':<br />
0003 .IF '&SYSDAY' NOT = 'MON' THEN;<br />
14:10:28 - FRI JUL 30, 1993<br />
UTY2402 Previous statement modified to:<br />
0004 .IF 'FRI' NOT = 'MON' THEN;<br />
0005 .RUN FILE UTNTS39;<br />
0006 .ENDIF;<br />
This example causes the RUN FILE command to be executed every day but Monday. It can be<br />
seen from this example that any of the system variables can be used as the subject condition<br />
within an IF/ELSE/ENDIF command construct. This allows creation of a script forcing certain<br />
events to occur or tasks to operate in a predetermined sequence, based on the current setting<br />
of the variable.<br />
As another example, if we create the following table:<br />
.SET TABLE TO 'TAB&SYSDAY';<br />
Create table &TABLE (<br />
Account_Number INTEGER NOT NULL,<br />
Last_Name VARCHAR(25),<br />
First_Name VARCHAR(25),<br />
Street_Address VARCHAR(30),<br />
City VARCHAR(20),<br />
State CHAR(2),<br />
60 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
Zip_Code CHAR(5)<br />
Balance DECIMAL(9,2) FORMAT '-$,$$$,$$$.99' )<br />
Unique primary Index (Account_Number);<br />
and then check the system variable &SYSRC for a return code to verify if the table already<br />
exists, a file containing options to continue or quit is logged at the console. Any other error<br />
return codes terminate the job with a <strong>Teradata</strong> <strong>Data</strong>base error, as follows:<br />
.SET CREATERC TO &SYSRC;<br />
.IF CREATERC = 3803 /* Table &TABLE already exists */<br />
.RUN FILE RUN01;<br />
.ELSE<br />
.IF CREATERC 0 THEN<br />
.LOGOFF CREATRC;<br />
.ENDIF<br />
.BEGIN LOAD ----------; /* No errors returned. We can start the job.*/<br />
/* T<strong>Pump</strong> statements go here..... */<br />
.END LOAD;<br />
.LOGOFF;<br />
File RUN01, which operates when the 3803 error causes the RUN FILE command to execute,<br />
contains the following options:<br />
.DISPLAY '&SYSUSER: Table FOO already exists....'<br />
to FILE console;<br />
.DISPLAY '&SYSUSER: Reply Continue anyway...'<br />
to FILE console;<br />
.DISPLAY '&SYSUSER: Reply Abort this JOB....'<br />
to FILE console;<br />
.DISPLAY '&SYSUSER: Reply or .Default '<br />
to FILE console;<br />
.ACCEPT RESPONSE FROM FILE CONSOLE;<br />
.IF RESPONSE 'C' THEN<br />
.LOGOFF CREATERC; /* Quit before we cause trouble */<br />
.ENDIF;<br />
Row Count Variables<br />
The row count variables, which are updated for each <strong>Teradata</strong> T<strong>Pump</strong> task, allow the insert,<br />
update, and delete row counts and the error table counts for each import to be queried:<br />
• &SYSDELCNT[n]<br />
• &SYSETCNT[n]<br />
• &SYSINSCNT[n]<br />
• &SYSUPDCNT[n]<br />
The values are stored in the <strong>Teradata</strong> T<strong>Pump</strong> utility restart log table and are restored after a<br />
client system or <strong>Teradata</strong> <strong>Data</strong>base restart.<br />
When EXECUTE INSERT|UPDATE|DELETE is used, <strong>Teradata</strong> T<strong>Pump</strong> must<br />
rely on the user to have correctly identified the action (INSERT, UPDATE, or DELETE) which<br />
the macro performs. <strong>Teradata</strong> T<strong>Pump</strong> cannot always determine the number of target tables,<br />
and therefore can only provide a single combined value for all target tables. Using the existing<br />
facility of variable substitution, each new system variable can be referenced as soon as the<br />
variable is defined. The new variables are defined during the import phase and should be<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 61
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
referenced after the END LOAD command and before any subsequent BEGIN LOAD<br />
command in the <strong>Teradata</strong> T<strong>Pump</strong> job script.<br />
The values of the new system variables must be stored in the <strong>Teradata</strong> T<strong>Pump</strong> log table and be<br />
restored after a restart.<br />
Utility Variables<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports utility variables. These variables are set via either the SET<br />
command or the ACCEPT command. Chapter 3 describes them in greater detail.<br />
Additionally, <strong>Teradata</strong> T<strong>Pump</strong> predefines some utility variables that provide information<br />
about the <strong>Teradata</strong> T<strong>Pump</strong> environment at execution time. The name of these variables must<br />
begin with an ampersand (&) when variable substitution is desired. The rest of the name must<br />
obey the rules for standard <strong>Teradata</strong> SQL column names. Consequently, the name of the<br />
variable without ampersand can be no longer than 29 characters, so that with an ampersand it<br />
does not exceed the 30-character limit.<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports an environmental variable for each DML statement executed. At<br />
the end of an import, a variable is established for each statement executed. The variable is<br />
named using the number of the import (one through four), the label of the clause<br />
“containing” the DML statement, and the number of the statement within the IMPORT’s<br />
apply clause.<br />
Variable Substitution<br />
Variable substitution, to allow for dynamic statement modification, is allowed on any<br />
statement by preceding the variable name with an ampersand. Each occurrence of a variable<br />
name, preceded by an ampersand, is replaced by its current value. Numeric values are<br />
permitted, but their values are converted to character for the replacement. This replacement<br />
occurs before the statement is analyzed. The replacement operation for a given statement<br />
occurs only once (one scan). This means that replacements generating ampersand variable<br />
names are not replaced.<br />
Even when it appears in a quoted string, an ampersand is always interpreted as the first<br />
character of a utility variable unless it is immediately followed by another ampersand. Such a<br />
double ampersand is converted to a single textual ampersand.<br />
If a reference to a utility variable is followed by a nonblank character that could appear in a<br />
variable name, there must be a period between the variable and the nonblank character(s).<br />
<strong>Teradata</strong> T<strong>Pump</strong> discards the period in this context.<br />
For example, if a utility variable called &x has the value xy and is to be immediately followed<br />
by the characters .ab in some context, the sequence of variable and characters must appear as<br />
&x..ab to produce xy.ab as the result. Such a double period is converted to a single textual<br />
period and concatenated with the value of the utility variable.<br />
ANSI/SQL DateTime <strong>Data</strong> Types<br />
The following ANSI/SQL DateTime data types can be specified as column or field modifiers in<br />
some of the <strong>Teradata</strong> SQL statements used with <strong>Teradata</strong> T<strong>Pump</strong>:<br />
62 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
• DATE<br />
• TIME<br />
• TIMESTAMP<br />
• INTERVAL<br />
For example, they can be used in CREATE TABLE statements and in INSERT statements.<br />
However, some restrictions may apply when ANSI/SQL DateTime data types are used.<br />
In the FIELD command, the ANSI/SQL DateTime data types must be converted to fixedlength<br />
CHAR(10) data types. See section “Using ANSI/SQL DateTime <strong>Data</strong> Types” on<br />
page 138 for a description of the fixed-length CHAR representations for each ANSI/SQL<br />
DateTime data types.<br />
Comments<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports C language style comments. A comment begins with a slash asterisk<br />
“/*” and all subsequent input is treated as a comment until a terminating asterisk slash “*/” is<br />
encountered. Comments may nest and they do not occur within string or character literals.<br />
For an example, a “/*” within a quoted string is not treated as the beginning of a comment.<br />
Comments are written to the message destination. Substitution of values for variable names<br />
continues within comments. If the variable name is required, two “&”s should be coded. Note<br />
that recursive comments are permitted, which means that to end the comment, the number of<br />
terminating “*/” sequences must match the number of start “/*” comment sequences that are<br />
outstanding.<br />
Comments can be optionally sent to <strong>Teradata</strong> <strong>Data</strong>base. If a comment is used together with a<br />
<strong>Teradata</strong> SQL statement, a semicolon may be placed as a terminating character to end the<br />
comment. The semicolon tells <strong>Teradata</strong> T<strong>Pump</strong> to strip out the comment so that it is not sent<br />
to <strong>Teradata</strong> <strong>Data</strong>base. If a semicolon is not used, the comment is sent to <strong>Teradata</strong> <strong>Data</strong>base<br />
together with the <strong>Teradata</strong> SQL statement.<br />
Nested comments are supported when they occur before or after <strong>Teradata</strong> SQL statements.<br />
Nested comments within <strong>Teradata</strong> SQL statements are not supported. Nested comments must<br />
terminate with a semicolon. If a semicolon is not appended, the comment is erroneously sent<br />
to <strong>Teradata</strong> <strong>Data</strong>base and a syntax error is returned.<br />
Specify a Character Set<br />
Table 16 describes ways to either specify the character set or accept a default specification.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 63
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
Table 16: Ways to Either Specify a Character Set or Accept a Default Specification<br />
Specification or Default Selection<br />
Runtime parameter specification<br />
Client System Specification<br />
<strong>Teradata</strong> <strong>Data</strong>base Default<br />
<strong>Teradata</strong> T<strong>Pump</strong> Utility Default<br />
Description<br />
Use when <strong>Teradata</strong> T<strong>Pump</strong> is invoked, as described earlier in<br />
this chapter:<br />
• charset=charactersetname for channel-attached z/OS client<br />
systems<br />
• -c charactersetname for network-attached UNIX and<br />
Windows client systems<br />
Specify the character set for a client system before invoking<br />
<strong>Teradata</strong> T<strong>Pump</strong> by configuring the:<br />
• HSHSPB parameter for channel-attached z/OS client<br />
systems<br />
• clispb.dat file for network-attached UNIX and Windows<br />
client systems<br />
Note: The charactersetname specification used when <strong>Teradata</strong><br />
T<strong>Pump</strong> is invoked always takes precedence over the current<br />
client system specification.<br />
If a charactersetname specification is not used when <strong>Teradata</strong><br />
T<strong>Pump</strong> is invoked, and there is no character set specification<br />
for the client system, <strong>Teradata</strong> T<strong>Pump</strong> uses the default<br />
specification in the <strong>Teradata</strong> <strong>Data</strong>base system table<br />
DBC.Hosts.<br />
Note: If the DBC.Hosts table specification for the default<br />
character set is relied upon, make sure that the initial logon is<br />
in the default character set:<br />
• EBCDIC for channel-attached z/OS client systems<br />
• ASCII for network-attached UNIX and Windows client<br />
systems<br />
If there is no character set specification in DBC.Hosts, then<br />
<strong>Teradata</strong> T<strong>Pump</strong> defaults to:<br />
• EBCDIC for channel-attached VM and z/OS client systems<br />
• ASCII for network-attached UNIX and Windows client<br />
systems<br />
Character Set Specifications for AXSMODs<br />
When an AXSMOD is used with <strong>Teradata</strong> T<strong>Pump</strong>, the session character set is passed as an<br />
attribute to the AXSMOD for possible use. The attribute value is a variable-length character<br />
string with either the character set name or the character representation of the character set<br />
ID. The attribute varies based on how the character set is specified.<br />
Table 17 contains a list of specifications for AXSMOD.<br />
64 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
Table 17: Character Set Specifications for AXSMOD<br />
Specify the session character set by<br />
ID<br />
name<br />
Attribute name is<br />
CHARSET_NUMBER<br />
CHARSET_NAME<br />
Multibyte Character Sets<br />
<strong>Teradata</strong> <strong>Data</strong>base supports multibyte characters in object names when the client session<br />
character set is UTF-8 or UTF-16. Refer to International Character Set Support for a list of<br />
valid characters used in object names. In <strong>Teradata</strong> T<strong>Pump</strong> scripts, double quote multibyte<br />
characters are used in object names.<br />
To log on with UTF-8 character set or other supported multibyte character sets (Chinese,<br />
Japanese, or Korean), create object names shorter than 30 bytes. This limitation applies to<br />
userid, password, and account. The logon string might fail if it exceeds 30 bytes per object<br />
name.<br />
Multibyte character sets impact the operation of certain <strong>Teradata</strong> T<strong>Pump</strong> commands, as well<br />
as object names in <strong>Teradata</strong> SQL statements.<br />
Table 18 describes the impact on multibyte character sets on certain <strong>Teradata</strong> T<strong>Pump</strong><br />
commands.<br />
Table 18: Character Sets Impact on <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
<strong>Teradata</strong> T<strong>Pump</strong><br />
Command Affected Element Impact<br />
ACCEPT Utility variables The utility variables may contain multibyte<br />
characters. If the client does not allow multibyte<br />
character set names, then the filename must be in<br />
uppercase English.<br />
BEGIN LOAD<br />
Table names:<br />
• Target tables<br />
• Error tables<br />
Target table names and error table names may<br />
contain multibyte characters.<br />
DML DML label name The label name in a DML statement may contain<br />
multibyte characters. The label name may be<br />
referenced in the APPLY clause of an IMPORT<br />
statement.<br />
FIELD Field name The field name specified may contain multibyte<br />
characters. The name can be referenced in other<br />
FIELD commands in NULLIF and field<br />
concatenation expressions, and in APPLY<br />
WHERE conditions in IMPORT commands. The<br />
FIELD command can also contain a NULLIF<br />
expression, which may use multibyte characters.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 65
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
Table 18: Character Sets Impact on <strong>Teradata</strong> T<strong>Pump</strong> Commands (continued)<br />
<strong>Teradata</strong> T<strong>Pump</strong><br />
Command Affected Element Impact<br />
FILLER Filler name The name specified in a FILLER command may<br />
contain multibyte characters.<br />
IF IF condition The condition in an IF statement may compare<br />
multibyte character strings.<br />
LAYOUT<br />
LOGON<br />
LOGTABLE<br />
Layout name<br />
CONTINUEIF condition<br />
User name<br />
Password<br />
Table name<br />
<strong>Data</strong>base name<br />
The layout name may contain multibyte<br />
characters and may be used in the LAYOUT<br />
clause of an IMPORT command. The<br />
CONTINUEIF condition may specify multibyte<br />
character set character comparisons.<br />
The user name and password may contain<br />
multibyte characters.<br />
The logtable name and database name may<br />
contain multibyte characters.<br />
NAME set SYSJOBNAME This variable may contain kanji characters.<br />
SET Utility variable The utility variable may contain multibyte<br />
characters. The variable can be substituted<br />
wherever substitution is allowed.<br />
TABLE Table and database name The table name (and database name if the table<br />
name is fully qualified) specified in a TABLE<br />
statement may contain multibyte characters.<br />
Avoid using the TABLE command when using<br />
UTF-8 or UTF-16 character sets by explicitly<br />
specifying the layout.<br />
Graphic <strong>Data</strong> Types<br />
To define double-byte character set data, the GRAPHIC, VARGRAPHIC, and LONG<br />
VARGRAPHIC data types are supported. <strong>Teradata</strong> T<strong>Pump</strong> accepts GRAPHIC data in the<br />
input data set or file containing the <strong>Teradata</strong> T<strong>Pump</strong> statements to be executed.<br />
The FIELD and FILLER statements that describe the input data are the statements affected by<br />
GRAPHIC data support. Table 19 lists the GRAPHIC data types that can be specified for the<br />
datadesc option in the FIELD or FILLER statement.<br />
Table 19: GRAPHIC <strong>Data</strong> Types for datadesc option in FIELD or FILLER Statement<br />
GRAPHIC <strong>Data</strong> Type Input Length Description<br />
GRAPHIC (n)<br />
if n specified, (n*2) bytes;<br />
otherwise, 2 bytes (n=1 is<br />
assumed)<br />
n double-byte characters<br />
VARGRAPHIC (n) m+2 bytes where m/2
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
Table 19: GRAPHIC <strong>Data</strong> Types for datadesc option in FIELD or FILLER Statement (continued)<br />
GRAPHIC <strong>Data</strong> Type Input Length Description<br />
LONG VARGRAPHIC m+2 bytes where m/2
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Program Considerations<br />
Table 20: Restrictions and Limitations on Operational Features and Functions (continued)<br />
Operational Feature/Function<br />
Date specification<br />
Access logging<br />
Primary Indexes and Partitioning<br />
Column Sets<br />
Restriction/Limitation<br />
For dates before 1900 or after 1999, the year portion of the<br />
date must be represented by four numerals (yyyy). The default<br />
of two numerals (yy) to represent the year is interpreted to be<br />
the 20th century, and must be overridden to avoid spurious<br />
year information. If the table column defined as type DATE<br />
does not have the proper format, the dates may not process<br />
properly. The correct date format must be specified at the time<br />
of table creation, for example:<br />
CREATE TABLE tab (ADATE DATE*);<br />
DEFINE a (char(10))<br />
INSERT tab (ADATE = :a(DATE, FORMAT 'yyyy-mmdd'));<br />
Unlike the MultiLoad and FastLoad utilities, access logging can<br />
cause a severe performance penalty in <strong>Teradata</strong> T<strong>Pump</strong>. This is<br />
because <strong>Teradata</strong> T<strong>Pump</strong> uses normal SQL operations rather<br />
than a proprietary protocol, and if all successful table updates<br />
are logged, a log entry is made for each operation. The primary<br />
index of the access logging table may then create the possibility<br />
of row hash conflicts.<br />
Specify values for the partitioning column set when<br />
performing <strong>Teradata</strong> T<strong>Pump</strong> deletes and updates to avoid lock<br />
contention problems that can degrade performance. Avoid<br />
updating primary index and partitioning columns with<br />
<strong>Teradata</strong> T<strong>Pump</strong> to minimize performance degradation.<br />
Termination Return Codes<br />
When a <strong>Teradata</strong> T<strong>Pump</strong> job terminates, it returns a completion code to the client system.<br />
Table 21 lists the conventions used.<br />
Table 21: Termination Return Codes<br />
Code<br />
Description<br />
0 Normal completion<br />
4 Warning<br />
8 User error<br />
12 Severe internal error<br />
16 No message destination is available<br />
Note: To avoid ambiguous or conflicting results, always use values greater than 20 when<br />
specifying a return code with the LOGOFF command.<br />
68 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Writing a <strong>Teradata</strong> T<strong>Pump</strong> Job Script<br />
Many CLI and <strong>Teradata</strong> <strong>Data</strong>base errors generate return codes of 12. For <strong>Teradata</strong> <strong>Data</strong>base<br />
errors that can be corrected and resubmitted, <strong>Teradata</strong> T<strong>Pump</strong> tries up to 16 times to resubmit<br />
and, at the end of this process, returns a code of 12. Many CLI and <strong>Teradata</strong> <strong>Data</strong>base errors<br />
generate the return code of 12, except for:<br />
• Errors on <strong>Teradata</strong> SQL statements outside of the <strong>Teradata</strong> T<strong>Pump</strong> task (before the BEGIN<br />
LOAD command or after the END LOAD command). <strong>Teradata</strong> T<strong>Pump</strong> ignores these<br />
errors, which display error messages but do not cause early termination, nor generate<br />
<strong>Teradata</strong> T<strong>Pump</strong> return codes.<br />
• Retryable errors or errors caused by <strong>Teradata</strong> <strong>Data</strong>base restarts.<br />
Writing a <strong>Teradata</strong> T<strong>Pump</strong> Job Script<br />
This section describes the contents of a <strong>Teradata</strong> T<strong>Pump</strong> job script and explains how to write<br />
one.<br />
Definition<br />
Caution:<br />
The <strong>Teradata</strong> T<strong>Pump</strong> job script, or program, is a set of <strong>Teradata</strong> T<strong>Pump</strong> commands and<br />
<strong>Teradata</strong> SQL statements that alter the contents of the specified target tables in <strong>Teradata</strong><br />
<strong>Data</strong>base. These commands and statements:<br />
• Insert new rows<br />
• Update some or all of the contents of selected existing rows<br />
• Delete selected existing rows<br />
Each <strong>Teradata</strong> T<strong>Pump</strong> job includes a number of support commands that establish and<br />
maintain the <strong>Teradata</strong> T<strong>Pump</strong> support environment, and a number of task commands that<br />
perform the actual database insert, update, or delete operations. These commands and<br />
statements identify and describe the input data to be applied to the target table, and then place<br />
that data into the target table. These activities may commence anytime after configuring the<br />
program as described in “<strong>Teradata</strong> T<strong>Pump</strong> Support Environment” on page 37.<br />
In the event of a client failure, the identical script must be resubmitted in order to restart. If<br />
the script is edited, a restart will not be permitted.<br />
Script Writing Guidelines<br />
The following script writing guidelines will help write a <strong>Teradata</strong> T<strong>Pump</strong> job script:<br />
• A script may contain up to four IMPORTs (tasks), delimited by a leading BEGIN LOAD<br />
command and a trailing END LOAD command.<br />
• The BEGIN LOAD command specifies the number of sessions and establishes a number of<br />
controlling parameters.<br />
The BEGIN LOAD command also specifies the error table, and is the only table specified.<br />
An optional qualifying database name may also be specified. This database name may be<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 69
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Writing a <strong>Teradata</strong> T<strong>Pump</strong> Job Script<br />
different from the database being modified, thus allowing tables to be created and dropped<br />
with no impact on the production database.<br />
In addition, the BEGIN LOAD command establishes acceptable threshold levels for<br />
important task controls, such as number and percentage of errors, session limits, duration<br />
of logon attempts in hours (tenacity), and checkpointing frequency. This command also<br />
provides optional controls to:<br />
• determine where any macros are placed<br />
• guarantee serial operations on given rows<br />
• select the number of statements to pack into a multiple-statement request<br />
• select a restart logic mode<br />
• The next item appearing in a script is usually a description of the records in the external<br />
file containing the change data for the target tables. The description of these input records<br />
appears in a sequence of commands headed by the LAYOUT command.<br />
The LAYOUT command tags the record layout being depicted with a unique name, which<br />
is then referenced by subsequent script commands in tasks throughout the rest of the job.<br />
The LAYOUT is followed by the supporting information contained in the sequence of one<br />
or more FIELD, FILLER, and TABLE commands.<br />
• Each FIELD command describes a single data item occupying a column in the input row.<br />
These items are described by data type, starting position, length, and several other<br />
characteristics. The FIELD command is used only for those items (columns) relevant to<br />
the current task, which are to be sent to <strong>Teradata</strong> <strong>Data</strong>base as changes to the target table.<br />
The FIELD command may include the KEY modifier if the column is to be considered part<br />
of the primary index for purposes of serialization.<br />
• Each FILLER command describes a column in the input row in the same way as the FIELD<br />
command. These FILLER fields are never sent to <strong>Teradata</strong> <strong>Data</strong>base. The FILLER<br />
command, however, identifies those columns which should not be sent to <strong>Teradata</strong><br />
<strong>Data</strong>base. Thus, if a sequence of 10 alternating FIELD and FILLER commands is used to<br />
describe 10 contiguous columns in the row, every other column, a total of five columns,<br />
would be sent to <strong>Teradata</strong> <strong>Data</strong>base.<br />
• The TABLE command identifies any existing table with the same layout as the input. The<br />
TABLE command is used when the changes are being enacted on entire rows, rather than<br />
selected columns.<br />
• The next entry in the script is the DML command, which is followed by the DML<br />
statements INSERT, UPDATE, and DELETE. The DML command creates an identifying<br />
label for the DML statement input, which immediately follows the command. The DML<br />
command also defines an error handling process for handling missing and duplicate rows,<br />
with respect to the error table.<br />
The three DML statements (INSERT, UPDATE, and DELETE) follow the DML command,<br />
and may occur in any order and in any quantity. The INSERT statement is used to place a<br />
complete and entirely new row into the target table.<br />
The UPDATE statement takes the data contents from columns in the input record, as<br />
defined with the LAYOUT, FIELD, FILLER command sequence, and substitutes the data<br />
70 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Writing a <strong>Teradata</strong> T<strong>Pump</strong> Job Script<br />
into the target table. The UPDATE rows are selected based on criteria specified in a<br />
conditional clause in the statement.<br />
The DML command also allows UPDATE and INSERT statements to be paired to provide<br />
<strong>Teradata</strong> T<strong>Pump</strong> with an upsert capability. This allows <strong>Teradata</strong> T<strong>Pump</strong>, in a single pass,<br />
to attempt an UPDATE and, if it fails, perform an INSERT on the same row.<br />
The DELETE statement removes entire rows from the target table whenever the evaluation<br />
of the deleting condition is true, as specified in a conditional clause in the statement.<br />
• The only information not yet provided in the task is the identity of the input data file, the<br />
starting and ending records in the file that are being used in this task, and other related<br />
information. This is done with the IMPORT command. This command basically tells the<br />
<strong>Teradata</strong> T<strong>Pump</strong> utility to bring in file X, from record A through record N, to associate the<br />
layout name (and specifications) with the input records, and to apply the desired DML<br />
(INSERT, UPDATE, and DELETE) statement to each record.<br />
• The last command in the script is the END LOAD command. This command flags the end<br />
of the commands and statements for the task, and triggers the program to begin execution<br />
of the task.<br />
For compatibility with the MultiLoad utility, multiple IMPORTs (up to four) are allowed<br />
within a single BEGIN/END LOAD pair. However, because <strong>Teradata</strong> T<strong>Pump</strong> does have an<br />
apply phase, there is no significant difference between a script containing four BEGIN/<br />
END LOAD pairs, each with one IMPORT, and a script with one BEGIN/END LOAD pair<br />
and four IMPORTs.<br />
Procedure for Writing a Script<br />
A complete <strong>Teradata</strong> T<strong>Pump</strong> job includes:<br />
• Invoking <strong>Teradata</strong> T<strong>Pump</strong><br />
• Logging onto <strong>Teradata</strong> <strong>Data</strong>base and establishing the <strong>Teradata</strong> T<strong>Pump</strong> support<br />
environment<br />
• Specifying the <strong>Teradata</strong> T<strong>Pump</strong> tasks<br />
• Logging off from <strong>Teradata</strong> <strong>Data</strong>base and terminating <strong>Teradata</strong> T<strong>Pump</strong>.<br />
Use the following procedure as a guide for writing <strong>Teradata</strong> T<strong>Pump</strong> job scripts:<br />
Writing <strong>Teradata</strong> T<strong>Pump</strong> Job Scripts<br />
1 Invoke <strong>Teradata</strong> T<strong>Pump</strong>, specifying the runtime options:<br />
• Normal or abbreviated (brief) printout<br />
• Number of buffers per session<br />
• Character set<br />
• Configuration file<br />
• Periodicity rate<br />
• Error logging function<br />
• Macro save option<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 71
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Writing a <strong>Teradata</strong> T<strong>Pump</strong> Job Script<br />
• Alternate run file<br />
• Verbose mode<br />
Refer to “Invoking <strong>Teradata</strong> T<strong>Pump</strong>” for detailed information about how to specify these<br />
options.<br />
2 Establish the <strong>Teradata</strong> T<strong>Pump</strong> support environment using the support commands<br />
summarized in Table 8.<br />
As a minimum, this part of the <strong>Teradata</strong> T<strong>Pump</strong> job must include:<br />
• A LOGTABLE command to specify the restart log table<br />
• A LOGON command to provide a logon string that is used to connect all <strong>Teradata</strong> SQL<br />
and <strong>Teradata</strong> T<strong>Pump</strong> utility sessions with <strong>Teradata</strong> <strong>Data</strong>base.<br />
3 Specify the <strong>Teradata</strong> T<strong>Pump</strong> task using the task commands summarized in Table 8.<br />
4 To specify another <strong>Teradata</strong> T<strong>Pump</strong> task:<br />
• Use the support commands to modify the <strong>Teradata</strong> T<strong>Pump</strong> support environment for<br />
the next task.<br />
• Use the task commands to specify the next task.<br />
Repeat these steps for each task in the <strong>Teradata</strong> T<strong>Pump</strong> job.<br />
Note: Though a single <strong>Teradata</strong> T<strong>Pump</strong> job can include a number of different tasks,<br />
limiting the jobs to a single task for each invocation of <strong>Teradata</strong> T<strong>Pump</strong> provides the<br />
highest assurance of a successful restart/recovery operation if a system failure interrupts<br />
the job.<br />
5 Use the LOGOFF command to disconnect all active sessions with <strong>Teradata</strong> <strong>Data</strong>base and<br />
terminate <strong>Teradata</strong> T<strong>Pump</strong> on the client system.<br />
<strong>Teradata</strong> T<strong>Pump</strong> Script Example<br />
The following example shows what a simple <strong>Teradata</strong> T<strong>Pump</strong> script and its corresponding<br />
output might look like. The lines that begin with 4-digit numbers (for example, 0001) are<br />
scripts, the rest are output.<br />
**** 19:02:53 UTY6633 WARNING: No configuration file, using build defaults<br />
========================================================================<br />
= =<br />
= <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Utility Release 13.10.00.000 =<br />
= Platform MVS =<br />
= =<br />
========================================================================<br />
= =<br />
= Copyright 1997-2009 <strong>Teradata</strong> Corporation. ALL RIGHTS RESERVED. =<br />
= =<br />
========================================================================<br />
**** 19:02:53 UTY2411 Processing start date: TUE OCT 06, 2009<br />
========================================================================<br />
= =<br />
= Logon/Connection =<br />
= =<br />
========================================================================<br />
0001 .LOGTABLE TPLOG0045;<br />
0002 .LOGON TDRT/IVYDB,;<br />
72 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Writing a <strong>Teradata</strong> T<strong>Pump</strong> Job Script<br />
**** 19:02:54 UTY8400 <strong>Teradata</strong> <strong>Data</strong>base Release: 13.10g.00.53<br />
**** 19:02:54 UTY8400 <strong>Teradata</strong> <strong>Data</strong>base Version: 13.10g.00.53<br />
**** 19:02:54 UTY8400 Default character set: EBCDIC<br />
**** 19:02:54 UTY8400 Current RDBMS has UDT support<br />
**** 19:02:54 UTY8400 Maximum supported buffer size: 1M<br />
**** 19:02:54 UTY8400 Upsert supported by RDBMS server<br />
**** 19:02:54 UTY8400 Array Support supported by RDBMS server<br />
**** 19:02:55 UTY6211 A successful connect was made to the RDBMS.<br />
**** 19:02:55 UTY6217 Logtable 'IVYDB.TPLOG0045' has been created.<br />
========================================================================<br />
= =<br />
= Processing Control Statements =<br />
= =<br />
========================================================================<br />
0003 .NAME TP0045;<br />
0004 .BEGIN LOAD<br />
SESSIONS 20<br />
PACK 20<br />
ROBUST ON<br />
SERIALIZE ON<br />
CHECKPOINT 0<br />
ERRORTABLE TPERR0045;<br />
========================================================================<br />
= =<br />
= Processing T<strong>Pump</strong> Statements =<br />
= =<br />
========================================================================<br />
0005 .LAYOUT LAY0045;<br />
0006 .FIELD F0 * integer key;<br />
0007 .FIELD F1 * integer;<br />
0008 .FIELD F2 * integer;<br />
0009 .FIELD F3 * char(38);<br />
0010 .DML LABEL DML0045;<br />
0011 UPDATE TPTBL0045 set F2 = F1 + 1 where F0 = :F0 ;<br />
0012 .IMPORT INFILEINDATA FROM 1 THRU 100<br />
LAYOUT LAY0045<br />
APPLY DML0045;<br />
0013 .END LOAD;<br />
**** 19:02:55 UTY6609 Starting to log on sessions...<br />
**** 19:02:56 UTY6610 Logged on 20 sessions.<br />
========================================================================<br />
= =<br />
= T<strong>Pump</strong> Import(s) Beginning =<br />
= =<br />
========================================================================<br />
**** 19:02:56 UTY6630 Options in effect for following T<strong>Pump</strong> Import(s):<br />
. Tenacity: 4 hour limit to successfully connect load sessions.<br />
. Max Sessions: 20 session(s).<br />
. Min Sessions: 16 session(s).<br />
. Checkpoint: 0 minute(s).<br />
. Errlimit: No limit in effect.<br />
. Restart Mode: ROBUST.<br />
. Serialization: ON.<br />
. Packing: 20 Statements per Request.<br />
. StartUp Rate: UNLIMITED Statements per Minute.<br />
**** 19:02:56 UTY6673 Warning: this T<strong>Pump</strong> job will not be restartable once data<br />
loading has begun, since checkpointing has been suppressed when checkpoint<br />
is specified to zero.<br />
**** 19:02:58 UTY6608 Import 1 begins.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 73
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
View <strong>Teradata</strong> T<strong>Pump</strong> Output<br />
**** 19:03:01 UTY6642 Import 1 statements: 100, requests: 20<br />
**** 19:03:01 UTY6643 Import 1 average statements per request: 5.00<br />
**** 19:03:01 UTY6644 Import 1 average statements per record: 1.00<br />
**** 19:03:01 UTY6645 Import 1 statements/session: avg. 5.00, min. 5.00, max. 5.00<br />
**** 19:03:01 UTY6646 Import 1 requests/session: average 1.00, minimum 1.00, maximum 1.00<br />
**** 19:03:01 UTY6648 Import 1 DBS wait time/session: avg. 0.05, min. 0.00, max. 1.00<br />
**** 19:03:01 UTY6649 Import 1 DBS wait time/request: avg. 0.05, min. 0.00, max. 1.00<br />
**** 19:03:01 UTY1803 Import processing statistics<br />
. IMPORT 1 Total thus far<br />
. ========= ==============<br />
Candidate records considered:........ 100....... 100<br />
Apply conditions satisfied:.......... 100....... 100<br />
Records logable to error table:...... 0....... 0<br />
Candidate records rejected:.......... 0....... 0<br />
** Statistics for Apply Label : DML0045<br />
Type <strong>Data</strong>base Table or Macro Name Activity<br />
U IVYDB TPTBL0045 100<br />
**** 19:03:02 UTY0821 Error table IVYDB.TPERR0045 is EMPTY, dropping table.<br />
0014 .IF &SYSUPDCNT = 100 THEN;<br />
**** 19:03:03 UTY2402 Previous statement modified to:<br />
0015 .IF 100 = 100 THEN;<br />
0016 .DISPLAY 'ROWCOUNT OK' TO FILE SYSTEST;<br />
0017 .ELSE;<br />
0018 .DISPLAY 'ROWCOUNT NOT OK' TO FILE SYSTEST;<br />
0019 .ENDIF;<br />
0020 .IF &SYSETCNT = 0 THEN;<br />
**** 19:03:03 UTY2402 Previous statement modified to:<br />
0021 .IF 0 = 0 THEN;<br />
0022 .DISPLAY 'NO ERRORS' TO FILE SYSTEST;<br />
0023 .ELSE;<br />
0024 .DISPLAY 'ERRORS!!!' TO FILE SYSTEST;<br />
0025 .ENDIF;<br />
========================================================================<br />
= =<br />
= Logoff/Disconnect =<br />
= =<br />
========================================================================<br />
**** 19:03:04 UTY6216 The restart log table has been dropped.<br />
**** 19:03:04 UTY6212 A successful disconnect was made from the RDBMS.<br />
**** 19:03:04 UTY2410 Total processor time used = '0.208906 Seconds'<br />
. Start : 19:02:53 - TUE OCT 06, 2009<br />
. End : 19:03:04 - TUE OCT 06, 2009<br />
. Highest return code encountered = '0'.<br />
View <strong>Teradata</strong> T<strong>Pump</strong> Output<br />
<strong>Teradata</strong> T<strong>Pump</strong> reporting functions provide timely information about the status of tasks in<br />
progress and those just completed.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> Statistics—The <strong>Teradata</strong> T<strong>Pump</strong> Statistics facility provides information<br />
on the success or failure of <strong>Teradata</strong> T<strong>Pump</strong> processing, with respect to data records<br />
transferred, target table row modifications, and error table statistics. These statistics are<br />
accumulated and presented at the end of the job.<br />
74 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
View <strong>Teradata</strong> T<strong>Pump</strong> Output<br />
<strong>Teradata</strong> T<strong>Pump</strong> Statistics<br />
• <strong>Teradata</strong> T<strong>Pump</strong> Options Messages—The options messages list the settings of some<br />
important <strong>Teradata</strong> T<strong>Pump</strong> task parameters.<br />
• Logoff/Disconnect Messages—The logoff/disconnect messages report several key run<br />
statistics.<br />
For each task, <strong>Teradata</strong> T<strong>Pump</strong> accumulates statistical items and writes them to the customary<br />
output destination of the external system, SYSPRINT/stdout (or the redirected stdout), or the<br />
destination specified in the ROUTE command.<br />
Table 22 lists the <strong>Teradata</strong> T<strong>Pump</strong> statistics kept.<br />
Table 22: <strong>Teradata</strong> T<strong>Pump</strong> Statistics<br />
Reference<br />
Number Reference Item Statistic<br />
1 Candidate records considered The number of records read.<br />
2 Apply conditions satisfied The number of statements sent to the database. If<br />
there are no rejected or skipped records, this value is<br />
equal to the number of candidate records, multiplied<br />
by the number of APPLY statements referenced in the<br />
import.<br />
3 Errors loggable to error table The number of records resulting in errors on the<br />
database. These records are found in the associated<br />
error table.<br />
4 Candidate records rejected The number of records which are rejected by the<br />
<strong>Teradata</strong> T<strong>Pump</strong> client code because they are<br />
formatted incorrectly.<br />
5 Statistics for Apply Label This area breaks out the total activity count for each<br />
statement within each DML APPLY clause. The Type<br />
column contains the values U for update, I for insert,<br />
and D for delete. Note that unlike the other reported<br />
statistics, these values are NOT accumulated across<br />
multiple imports.<br />
6 Number of database requests<br />
sent<br />
These statistics are displayed only in the verbose<br />
mode, which is selected as a runtime parameter,<br />
VERBOSE, in z/OS, or -v in UNIX.<br />
In addition, <strong>Teradata</strong> T<strong>Pump</strong> receives a count of the number of rows deleted from <strong>Teradata</strong><br />
<strong>Data</strong>base. <strong>Teradata</strong> T<strong>Pump</strong> writes it either to SYSPRINT/stdout (or the redirected stdout), or<br />
the destination specified in the ROUTE command.<br />
If a record is rejected due to an error, as in the case of a duplicate, missing, or extra insert,<br />
update, or delete row, the following statistical output shows that an error condition occurred.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 75
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
View <strong>Teradata</strong> T<strong>Pump</strong> Output<br />
. IMPORT 1 Total thus far<br />
. ========= ==============<br />
Candidate records considered:........ 8....... 8
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
View <strong>Teradata</strong> T<strong>Pump</strong> Output<br />
F2 integer,<br />
F3 char(38))<br />
UNIQUE PRIMARY INDEX(F0);<br />
**** 01:33:28 UTY1016 'CREATE' request successful.<br />
0004 CREATE TABLE TAB2, FALLBACK, NO JOURNAL (<br />
F0 integer,<br />
F1 integer,<br />
F2 integer,<br />
F3 char(38))<br />
UNIQUE PRIMARY INDEX(F0);<br />
**** 01:33:29 UTY1016 'CREATE' request successful.<br />
0005 .BEGIN LOAD<br />
SESSIONS 10<br />
ROBUST ON<br />
SERIALIZE ON<br />
CHECKPOINT 10<br />
NOMONITOR<br />
ERRORTABLE ET_TEST1;<br />
========================================================================<br />
= =<br />
= Processing T<strong>Pump</strong> Statements =<br />
= =<br />
========================================================================<br />
0006 .LAYOUT LAY1A;<br />
0007 .FIELD F0 * integer key;<br />
0008 .FIELD F1 * integer;<br />
0009 .FIELD F2 * integer;<br />
0010 .FIELD F3 * char(38);<br />
0011 .DML LABEL TAB1PART1;<br />
0012 INSERT into tab1 values (:F0,:F1,:F2,:F3);<br />
0013 .DML LABEL TAB2PART1;<br />
0014 INSERT into tab2 values (:F0,:F1,:F2,:F3);<br />
0015 .DML LABEL TAB1UPSERT<br />
DO INSERT FOR MISSING UPDATE ROWS<br />
IGNORE DUPLICATE INSERT ROWS;<br />
0016 UPDATE tab1 set F2=:F2 + 1 where f0=:f0 + 50 and f1 < 4;<br />
0017 INSERT into tab1 ( F0, F1, F2, F3) values (:F0 + 50,:F1,:F2,:F3);<br />
0018 .DML LABEL TAB2UPSERT<br />
DO INSERT FOR MISSING UPDATE ROWS<br />
IGNORE DUPLICATE INSERT ROWS;<br />
0019 UPDATE tab2 set F2=:F2 + 1 where f0=:f0 + 50 and f1 < 4;<br />
0020 INSERT into tab2 ( F0, F1, F2, F3) values (:F0 + 50,:F1,:F2,:F3);<br />
0021 .IMPORT INFILE INDATA<br />
FROM 1 THRU 100<br />
LAYOUT LAY1A<br />
APPLY TAB1PART1<br />
APPLY TAB2PART1;<br />
0022 .IMPORT INFILE INDATA<br />
FROM 1 THRU 100<br />
LAYOUT LAY1A<br />
APPLY TAB1UPSERT<br />
APPLY TAB2UPSERT;<br />
0023 .END LOAD;<br />
**** 01:33:29 UTY6609 Starting to log on sessions...<br />
**** 01:33:32 UTY6610 Logged on 10 sessions.<br />
========================================================================<br />
= =<br />
= T<strong>Pump</strong> Import(s) Beginning =<br />
= =<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 77
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
View <strong>Teradata</strong> T<strong>Pump</strong> Output<br />
========================================================================<br />
**** 01:33:32 UTY6630 Options in effect for following T<strong>Pump</strong> Import(s):<br />
. Tenacity: 4 hour limit to successfully connect load sessions.<br />
. Max Sessions: 10 session(s).<br />
. Min Sessions: 8 session(s).<br />
. Checkpoint: 10 minute(s).<br />
. Errlimit: No limit in effect.<br />
. Restart Mode: ROBUST.<br />
. Serialization: ON.<br />
. Packing: 20 Statements per Request.<br />
. StartUp Rate: UNLIMITED Statements per Minute.<br />
**** 01:33:34 UTY6608 Import 1 begins.<br />
**** 01:33:38 UTY6641 Since last chkpt., 100 recs. in, 200 stmts., 10 reqs<br />
**** 01:33:38 UTY6647 Since last chkpt., avg. DBS wait time: 0.40<br />
**** 01:33:38 UTY6612 Beginning final checkpoint...<br />
**** 01:33:38 UTY6641 Since last chkpt., 100 recs. in, 200 stmts., 10 reqs<br />
**** 01:33:38 UTY6647 Since last chkpt., avg. DBS wait time: 0.40<br />
**** 01:33:38 UTY6607 Checkpoint Completes with 200 rows sent.<br />
**** 01:33:38 UTY6642 Import 1 statements: 200, requests: 10<br />
**** 01:33:38 UTY6643 Import 1 average statements per request: 20.00<br />
**** 01:33:38 UTY6644 Import 1 average statements per record: 1.00<br />
**** 01:33:38 UTY6645 Import 1 statements/session: avg. 20.00, min. 20.00, max. 20.00<br />
**** 01:33:38 UTY6646 Import 1 requests/session: average 1.00, minimum 1.00, maximum 1.00<br />
**** 01:33:38 UTY6648 Import 1 DBS wait time/session: avg. 0.40, min. 0.00, max. 2.00<br />
**** 01:33:38 UTY6649 Import 1 DBS wait time/request: avg. 0.40, min. 0.00, max. 2.00<br />
**** 01:33:38 UTY1803 Import processing statistics<br />
. IMPORT 1 Total thus far<br />
. ========= ==============<br />
Candidate records considered:........ 100....... 100
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
View <strong>Teradata</strong> T<strong>Pump</strong> Output<br />
Candidate records rejected:.......... 0....... 0<br />
Number of RDBMS requests sent:....... 10....... 20<br />
** Statistics for Apply Label : TAB1UPSERT<br />
Type <strong>Data</strong>base Table or Macro Name Activity<br />
U ARIDB tab1 50<br />
I ARIDB tab1 50<br />
** Statistics for Apply Label : TAB2UPSERT<br />
Type <strong>Data</strong>base Table or Macro Name Activity<br />
U ARIDB tab2 50<br />
I ARIDB tab2 50<br />
**** 01:33:54 UTY0821 Error table ARIDB.ET_TEST1 is EMPTY, dropping table.<br />
0024 .LOGOFF;<br />
========================================================================<br />
= =<br />
= Logoff/Disconnect =<br />
= =<br />
========================================================================<br />
**** 01:33:58 UTY6216 The restart log table has been dropped.<br />
**** 01:33:58 UTY6212 A successful disconnect was made from the RDBMS.<br />
**** 01:33:58 UTY2410 Total processor time used = '0.8 Seconds'<br />
. Start : 01:33:23 - TUE OCT 06, 2009<br />
. End : 01:33:58 - TUE OCT 06, 2009<br />
. Highest return code encountered = '0'.<br />
The above script has a realistic degree of complexity. The script demonstrates a <strong>Teradata</strong><br />
T<strong>Pump</strong> job that contains two imports and each import has at least two associated statements.<br />
For the first import there are two statements, each of which is specified in a separate DML<br />
statement. The IMPORT statement references the two statements through two APPLY clauses.<br />
The second import adds additional complexity by having two statements in each DML<br />
statement. In this case, the two statements in each DML compose an upsert statement.<br />
<strong>Teradata</strong> T<strong>Pump</strong> Options Messages<br />
The options message lists the settings of some important <strong>Teradata</strong> T<strong>Pump</strong> task parameters. A<br />
few examples follow:<br />
Example 1<br />
The following example depicts a typical options message.<br />
**** 17:09:34 UTY6630 Options in effect for following T<strong>Pump</strong> Import(s):<br />
. Tenacity: 4 hour limit to successfully connect load sessions.<br />
. Max Sessions: 10 session(s).<br />
. Min Sessions: 8 session(s).<br />
. Checkpoint: 10 minute(s).<br />
. Errlimit: 1 rejected record(s).<br />
. Restart Mode: ROBUST.<br />
. Serialization: ON.<br />
. Packing: 20 Statements per Request.<br />
. StartUp Rate: UNLIMITED Statements per Minute.<br />
Example 2<br />
In this example, the error limit is expressed as a percent of rows, not as a hard limit, the<br />
recovery mode is simple, and serialization is on.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 79
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
View <strong>Teradata</strong> T<strong>Pump</strong> Output<br />
**** 17:09:34 UTY6630 Options in effect for following T<strong>Pump</strong> Import(s):<br />
. Tenacity: 4 hour limit to successfully connect load sessions.<br />
. Max Sessions: 4 session(s).<br />
. Min Sessions: 4 session(s).<br />
. Checkpoint: 5 minutes.<br />
. Errlimit: 10% of records rejected.<br />
. Restart Mode: SIMPLE.<br />
. Serialization: ON.<br />
. Packing: 20 Statements per Request.<br />
. StartUp Rate: 500 Statements per Minute.<br />
Example 3<br />
In this example, there is no error limit in effect and tenacity has been set to zero.<br />
**** 17:09:34 UTY6630 Options in effect for following T<strong>Pump</strong> Import(s):<br />
. Tenacity: Sessions must successfully connect on first try.<br />
. Max Sessions: 1 session(s).<br />
. Min Sessions: 1 session(s).<br />
. Checkpoint: 5 minutes.<br />
. Errlimit: No limit in effect.<br />
. Restart Mode: ROBUST.<br />
. Serialization: OFF.<br />
. Packing: 40 Statements per Request.<br />
. StartUp Rate: UNLIMITED Statements per Minute.<br />
Logoff/Disconnect Messages<br />
In response to the LOGOFF command, <strong>Teradata</strong> T<strong>Pump</strong> completes the step by disconnecting<br />
active sessions and reporting on total run statistics. The logtable is either dropped or kept,<br />
depending on the success or failure of the previous activity.<br />
When a <strong>Teradata</strong> T<strong>Pump</strong> session is logged off, the following status messages are written to the<br />
SYSPRINT/stdout (or the redirected stdout) data destination, or to the destination specified<br />
in the ROUTE command.<br />
**** 01:57:45 UTY6216 The restart log table has been dropped.****<br />
**** 01:57:45 UTY6212 A successful disconnect was made from the RDBMS.<br />
**** 01:57:45 UTY2410 Total processor time used = '0.270389 Seconds'****<br />
. Start : 01:33:23 - TUE OCT 06, 2009<br />
. End : 01:33:58 - TUE OCT 06, 2009<br />
. Highest return code encountered = '0'.<br />
Progress Monitoring<br />
<strong>Teradata</strong> T<strong>Pump</strong> differs from most other <strong>Teradata</strong> load utilities in that there is no support for<br />
it in QrySessn. Instead, the optional <strong>Teradata</strong> T<strong>Pump</strong> Monitor (see Table 23) is the only<br />
method for remotely overseeing the progress of the utility. Note however, that while <strong>Teradata</strong><br />
T<strong>Pump</strong> requests do appear in the QrySessn output, they are displayed as a collection of<br />
individual transactions instead of being summarized into one utility instance.<br />
80 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Monitor <strong>Teradata</strong> T<strong>Pump</strong> Jobs<br />
Monitor <strong>Teradata</strong> T<strong>Pump</strong> Jobs<br />
Monitor Interface Table<br />
<strong>Teradata</strong> T<strong>Pump</strong> provides an optional monitoring tool to monitor and update <strong>Teradata</strong><br />
T<strong>Pump</strong> jobs. The <strong>Teradata</strong> T<strong>Pump</strong> Monitor provides for run-time monitoring of the <strong>Teradata</strong><br />
T<strong>Pump</strong> job that allows tracking and altering the rate at which requests are issued to the<br />
database via a command-line interface.<br />
The <strong>Teradata</strong> T<strong>Pump</strong> Monitor provides the following functions:<br />
• Provides a set of SQL scripts that create a Monitor Interface table. <strong>Teradata</strong> T<strong>Pump</strong><br />
updates this table approximately once every minute.<br />
• Allows the status of an import to be learned by querying against the Monitor Interface<br />
table.<br />
• Allows altering the statement rate of an import by updating the Monitor Interface table.<br />
Use SQL scripts shipped with <strong>Teradata</strong> T<strong>Pump</strong> to create a Monitor Interface Table<br />
(SysAdmin.T<strong>Pump</strong>StatusTbl) in the database where <strong>Teradata</strong> T<strong>Pump</strong> maintains information<br />
about an import. <strong>Teradata</strong> T<strong>Pump</strong> both reads commands from and updates status in the<br />
Monitor Interface Table.<br />
This table is required in order to use the <strong>Teradata</strong> T<strong>Pump</strong> Monitor functionality, but is<br />
otherwise optional. If the table does not exist, the worst that will happen is that <strong>Teradata</strong><br />
T<strong>Pump</strong> issues a warning message indicating this fact.<br />
This table must be secure, so it is created by the DBA.<br />
An SQL script tpumpar.csql is provided in the <strong>Teradata</strong> T<strong>Pump</strong> installation that performs the<br />
appropriate setup. The tpumpar.csql script includes an action request.<br />
Table 23 contains the monitor interface columns (other columns exist in order to support<br />
future functionality):<br />
Table 23: Monitor Interface Table<br />
Name Type Notes<br />
Import INTEGER Part of primary index. The import number. (There may be<br />
multiple imports in a <strong>Teradata</strong> T<strong>Pump</strong> job.<br />
InitStartDate DATE The initial start date of the import.<br />
InitStartTime FLOAT The initial start time of the import.<br />
Complete CHAR(1) Y if this import is complete. (There may be multiple<br />
imports.)<br />
CurrStartDate DATE The last date this import was started (may be a restart).<br />
CurrStartTime FLOAT The last time this import was started (may be a restart).<br />
LastUpdateDate DATE The last date this import updated the table.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 81
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Monitor <strong>Teradata</strong> T<strong>Pump</strong> Jobs<br />
Table 23: Monitor Interface Table (continued)<br />
Name Type Notes<br />
LastUpdateTime FLOAT The last time this import updated the table.<br />
LogDB VARCHAR(32) Part of primary index. The name of the log table database.<br />
LogTable VARCHAR(32) Part of primary index. The name of the log table.<br />
PeriodsDesired INTEGER Allows specifying the desired periodicity.<br />
PleaseAbort CHAR(1) Set to Y to abort.<br />
RecordsErrored INTEGER The number of records resulting in errors on the database.<br />
RecordsOut INTEGER The number of statements sent to the database.<br />
RecordsSkipped INTEGER The number of records skipped for apply conditions.<br />
RecordsRejcted INTEGER The number of records rejected for bad data (on host)<br />
RecordsRead INTEGER The number of records read.<br />
RequestAction CHAR(1) Before processing any action request, a message will be logged<br />
stating that the requested action is being taken. The following<br />
action requests are permitted:<br />
• Blank – No action<br />
• C – Take a checkpoint and continue the job<br />
• P – Take a checkpoint and pause until a subsequent action<br />
request resumes or terminates the job<br />
• R – Resume the job<br />
• T – Take a checkpoint and terminate the job with rc = 8.<br />
The job may be restarted.<br />
• A – Terminate the job immediately with rc = 12. The job<br />
may be restarted.<br />
RequestChange CHAR(1) Set to Y by the user so <strong>Teradata</strong> T<strong>Pump</strong> will pick up the<br />
changes. Set to N by <strong>Teradata</strong> T<strong>Pump</strong> after changes are<br />
accepted.<br />
RestartCount INTEGER The number of times this import has been restarted.<br />
StmtsDesired INTEGER The statement rate (if StmtsUnLimited is N)<br />
StmtsUnLimited CHAR(1) Y if this import running without a statement rate limit.<br />
If N, refer to StmtsDesired for the statement rate.<br />
UserName VARCHAR(32) The name of the user running the job. Used for security.<br />
Security concerns dictate that the SQL script to set up the Monitor Interface table for <strong>Teradata</strong><br />
T<strong>Pump</strong> monitoring also establishes a set of views and macros in addition to the<br />
T<strong>Pump</strong>StatusTbl. Although database administrators can access the table directly, using<br />
macros and views is recommended because they provide for security and ensure rational use<br />
of the table.<br />
82 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Monitor <strong>Teradata</strong> T<strong>Pump</strong> Jobs<br />
Without action on the part of the database administrator, no normal user can update the<br />
status of jobs. To grant controlled update access to the T<strong>Pump</strong>StatusTbl, a single command<br />
will suffice:<br />
“GRANT EXEC ON T<strong>Pump</strong>Macro TO _____;”<br />
The macros for <strong>Teradata</strong> T<strong>Pump</strong> monitoring reside in the database T<strong>Pump</strong>Macro and<br />
SysAdmin.<br />
<strong>Teradata</strong> T<strong>Pump</strong> Monitor Views<br />
The following views of the Monitor Interface table are available:<br />
View SysAdmin.T<strong>Pump</strong>Status<br />
This view is for database administrators and lets them see all running <strong>Teradata</strong> T<strong>Pump</strong><br />
imports.<br />
CREATE VIEW SysAdmin.T<strong>Pump</strong>Status AS LOCKING<br />
SysAdmin.T<strong>Pump</strong>StatusTbl FOR ACCESS<br />
SELECT * FROM SysAdmin.T<strong>Pump</strong>StatusTbl;<br />
View SysAdmin.T<strong>Pump</strong>StatusX<br />
This view is for all users and provides a view of <strong>Teradata</strong> T<strong>Pump</strong> jobs. However, this view will<br />
only show jobs which are “owned” by the user.<br />
CREATE VIEW SysAdmin.T<strong>Pump</strong>StatusX AS LOCKING<br />
SysAdmin.T<strong>Pump</strong>StatusTbl FOR ACCESS<br />
SELECT * FROM SysAdmin.T<strong>Pump</strong>StatusTbl<br />
WHERE UserName = USER;<br />
<strong>Teradata</strong> T<strong>Pump</strong> Monitor Macros<br />
<strong>Teradata</strong> T<strong>Pump</strong> Monitor provides a set of macros that can be used to update the Monitor<br />
Interface table and to monitor and control individual <strong>Teradata</strong> T<strong>Pump</strong> import jobs. The<br />
following <strong>Teradata</strong> T<strong>Pump</strong> Monitor macros are provided:<br />
Macro T<strong>Pump</strong>Macro. T<strong>Pump</strong>UpdateSelect<br />
This macro is provided for database administrators to use to manipulate and monitor<br />
individual <strong>Teradata</strong> T<strong>Pump</strong> jobs:<br />
CREATE MACRO SysAdmin.T<strong>Pump</strong>UpdateSelect<br />
(<br />
LogDB<br />
VARCHAR(32),<br />
LogTable VARCHAR(32),<br />
UserName VARCHAR(32),<br />
Import<br />
INTEGER,<br />
RequestChange CHAR(1),<br />
StmtsUnLimited CHAR(1),<br />
StmtsDesired INTEGER,<br />
PeriodsDesired INTEGER<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 83
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Monitor <strong>Teradata</strong> T<strong>Pump</strong> Jobs<br />
)<br />
AS<br />
(<br />
LOCK ROW WRITE /* OR LOCKING Sysadmin.T<strong>Pump</strong>Status for WRITE */<br />
SELECT<br />
RecordsOut ,<br />
RecordsSkipped ,<br />
RecordsRejcted ,<br />
RecordsRead ,<br />
RecordsErrored<br />
FROM<br />
SysAdmin.T<strong>Pump</strong>StatusTbl<br />
WHERE<br />
UserName = :UserName AND<br />
LogDB = :LogDB AND<br />
Import = :Import AND<br />
LogTable = :LogTable<br />
; UPDATE SysAdmin.T<strong>Pump</strong>StatusTbl<br />
SET<br />
RequestChange = :RequestChange,<br />
StmtsUnLimited = :StmtsUnLimited,<br />
StmtsDesired = :StmtsDesired,<br />
PeriodsDesired = :PeriodsDesired<br />
WHERE<br />
UserName = :UserName AND<br />
LogDB = :LogDB AND<br />
LogTable = :LogTable AND<br />
Import = :Import ;<br />
);mport = :Import ;<br />
);<br />
Macro T<strong>Pump</strong>Macro. UserUpdateSelect<br />
The macro UserUpdateSelect is provided to monitor/update <strong>Teradata</strong> T<strong>Pump</strong> jobs.<br />
CREATE MACRO T<strong>Pump</strong>Macro.UserUpdateSelect<br />
(<br />
LogDB<br />
VARCHAR(32),<br />
LogTable VARCHAR(32),<br />
Import<br />
INTEGER,<br />
RequestChange CHAR(1),<br />
StmtsUnLimited CHAR(1),<br />
StmtsDesired INTEGER,<br />
PeriodsDesired INTEGER<br />
)<br />
AS<br />
(<br />
LOCK ROW WRITE /* OR LOCKING Sysadmin.T<strong>Pump</strong>Status FOR WRITE */<br />
SELECT<br />
RecordsOut ,<br />
RecordsSkipped ,<br />
RecordsRejcted ,<br />
RecordsRead ,<br />
RecordsErrored<br />
FROM<br />
SysAdmin.T<strong>Pump</strong>StatusTbl<br />
WHERE<br />
UserName = USER<br />
AND<br />
84 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Estimating Space Requirements<br />
LogDB = :LogDB AND<br />
Import = :Import AND<br />
LogTable = :LogTable<br />
);<br />
; UPDATE SysAdmin.T<strong>Pump</strong>StatusTbl<br />
SET<br />
RequestChange = :RequestChange,<br />
StmtsUnLimited = :StmtsUnLimited,<br />
StmtsDesired = :StmtsDesired,<br />
PeriodsDesired = :PeriodsDesired<br />
WHERE<br />
UserName = USER AND<br />
LogDB = :LogDB AND<br />
LogTable = :LogTable AND<br />
Import = :Import ;<br />
Estimating Space Requirements<br />
This section discusses space requirements for the <strong>Teradata</strong> T<strong>Pump</strong> log table.<br />
A row of approximately 200 bytes is written to the log table on each of the following events.<br />
• One row is written at initialization.<br />
• One row is written for each SQL statement issued through the <strong>Teradata</strong> T<strong>Pump</strong> support<br />
environment.<br />
• One row is written at the BEGIN LOAD command.<br />
• One row is written at the END LOAD command.<br />
• Two rows are written for each IMPORT command.<br />
• One row is written for each statement used in a load (between the BEGIN LOAD<br />
command and the END LOAD command).<br />
• One row is written for each checkpoint taken.<br />
• In the ROBUST mode, for each packed request, a number of partial checkpoint rows are<br />
written to the log between checkpoints. The rows are deleted each time a checkpoint is<br />
written.<br />
The partial checkpoint row contains 117 + (12 * packfactor) bytes per transaction. So the<br />
number of partial checkpoints will vary, depending on the checkpoint frequency, the power of<br />
the loading host, and the power of the <strong>Teradata</strong> target database.<br />
Thus, an equation for the space is:<br />
200 + 200 * each statement in the support environment + 400 * each BEGIN/END LOAD +<br />
200 * each statement issued as DML + 200 * the estimated number of checkpoints + (117 +<br />
(12 * packfactor)) * the number of partial checkpoints. A simplified version would be:<br />
R = 200 + 200S + 400L + 200D + 200C + (117 + (12P))N,<br />
where:<br />
R = Required space for <strong>Teradata</strong> T<strong>Pump</strong> log table<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 85
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Estimating Space Requirements<br />
S = Each SQL statement issued through the support environment<br />
L = Each BEGIN/END LOAD command pair<br />
D = Each DML statement<br />
C = Estimated number of checkpoints<br />
P = Packfactor<br />
N = Number of partial checkpoints<br />
Space Calculation Example<br />
The following example of how <strong>Teradata</strong> T<strong>Pump</strong> log table space is derived takes a simple load<br />
that consists of the following script:<br />
LOGTABLE CME.TLddNT14H;<br />
.LOGON OPNACC1/CME,CME;<br />
DROP TABLE TBL14TA;<br />
DROP TABLE TBL14TB;<br />
DROP TABLE tlnt14err;<br />
CREATE TABLE TBL14TA,FALLBACK<br />
(ABYTEINT BYTEINT,<br />
ASMALLINT SMALLINT,<br />
AINTEGER INTEGER,<br />
ADECIMAL DECIMAL (5,2),<br />
ACHAR CHAR (5),<br />
ABYTE BYTE(1),<br />
AFLOAT FLOAT,<br />
ADATE DATE)<br />
UNIQUE PRIMARY INDEX (ASMALLINT);<br />
CREATE TABLE TBL14TB,FALLBACK<br />
(ABYTEINT BYTEINT,<br />
ASMALLINT SMALLINT,<br />
AINTEGER INTEGER,<br />
ADECIMAL DECIMAL (5,2),<br />
CHAR CHAR (5),<br />
ABYTE BYTE(1),<br />
AFLOAT FLOAT,<br />
ADATE DATE)<br />
UNIQUE PRIMARY INDEX (ASMALLINT);<br />
/*****************************************************************/<br />
/* BEGIN TLOAD WITH ALL THE OPTIONS SPECIFIED SUCH AS ERRLIMIT, **/<br />
/* CHECKPOINT, SESSIONS,TENACITY **/<br />
/*****************************************************************/<br />
.BEGIN LOAD ERRLIMIT 5 CHECKPOINT 15 SESSIONS 4 1 TENACITY 2<br />
ERRORTABLE tlnt14err ROBUST ON PACK 20;<br />
.LAYOUT LAY1A;<br />
.FILLER ATEST * BYTEINT;<br />
.FIELD ABYTEINT * BYTEINT;<br />
.FIELD ASMALLINT * SMALLINT;<br />
.FIELD AINTEGER * INTEGER;<br />
.FIELD ADECIMAL * DECIMAL (5,2);<br />
.FIELD ACHAR * CHAR (5);<br />
.FIELD ABYTE * BYTE(1);<br />
.FIELD AFLOAT * FLOAT;<br />
.FIELD ADATE * DATE;<br />
.DML LABEL LABELA IGNORE DUPLICATE ROWS IGNORE MISSING ROWS<br />
86 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Estimating Space Requirements<br />
IGNORE EXTRA ROWS;<br />
INSERT INTO TBL14TA VALUES (:ABYTEINT,:ASMALLINT,:AINTEGER,:ADECIMAL,<br />
:ACHAR,:ABYTE,:AFLOAT,:ADATE);<br />
.DML LABEL LABELB IGNORE DUPLICATE ROWS IGNORE MISSING ROWS<br />
IGNORE EXTRA ROWS;<br />
INSERT INTO TBL14TB VALUES (:ABYTEINT,:ASMALLINT,:AINTEGER,:ADECIMAL,<br />
:ACHAR,:ABYTE,:AFLOAT,:ADATE);<br />
.IMPORT INFILE ./tlnt014.dat<br />
LAYOUT LAY1A FROM 1 FOR 400<br />
APPLY LABELA WHERE ATEST = 1<br />
APPLY LABELB WHERE ATEST = 2;<br />
.END LOAD;<br />
.LOGOFF;<br />
From this script the space requirements can be calculated to be:<br />
• 200 bytes for initialization +<br />
• 200 bytes * 6 for support environment statements +<br />
• 200 bytes * 2 for DML SQL statements +<br />
• 400 bytes for the BEGIN/END load pair +<br />
• 200 bytes for the IMPORT<br />
which is a starting total of 2400 bytes.<br />
Further, assume that <strong>Teradata</strong> <strong>Data</strong>base can accept about 32 statements per second and that<br />
the load takes a little more than an hour to complete.<br />
The space for partial and complete checkpoints is calculated with the following steps:<br />
Calculating the Space for Checkpoints<br />
1 32 statements per second translates to 1920 statements per minute.<br />
2 1920 / 20 (the packing factor) = 93 partial checkpoints/minute<br />
3 Multiply by 15 (15 minute CP frequency) = 1395 partial checkpoint rows maximum.<br />
4 Each checkpoint row is 117 + (12 * 20) = 357 bytes so 498,015 bytes are in partial<br />
checkpoint rows.<br />
5 Given that the load takes just more than an hour, assume 5 checkpoints are written at<br />
300 bytes each.<br />
Now we have the grand total of space in the log table:<br />
2,400 + 498,015 + 1,500 = 517,980 bytes.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 87
Chapter 2: Using <strong>Teradata</strong> T<strong>Pump</strong><br />
Estimating Space Requirements<br />
88 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
CHAPTER 3<br />
<strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
This chapter describes the <strong>Teradata</strong> T<strong>Pump</strong> commands and <strong>Teradata</strong> SQL statements that<br />
execute from the <strong>Teradata</strong> T<strong>Pump</strong> utility.<br />
Experienced <strong>Teradata</strong> T<strong>Pump</strong> users can also refer to the simplified command descriptions in<br />
the <strong>Teradata</strong> T<strong>Pump</strong> chapter of <strong>Teradata</strong> Tools and Utilities Command Summary. This book<br />
provides the syntax diagrams and a brief description of the syntax variables for each <strong>Teradata</strong><br />
client utility.<br />
Syntax Notes<br />
This section provides information which should be known before using <strong>Teradata</strong> T<strong>Pump</strong><br />
commands and <strong>Teradata</strong> SQL statements.<br />
Each <strong>Teradata</strong> T<strong>Pump</strong> command:<br />
Object Name Restrictions<br />
• Must begin on a new line.<br />
• Must start with a period (.) character. In this document, <strong>Teradata</strong> T<strong>Pump</strong> command<br />
periods are shown only in syntax diagrams and examples, but not in the narrative text.<br />
• Must end with a semicolon (;) character.<br />
• May continue for as many lines as necessary, as long as it satisfies the beginning and<br />
ending requirements.<br />
Statements are standard <strong>Teradata</strong> SQL statements and are not preceded by periods.<br />
The following Syntax rules apply to object names:<br />
• A semicolon cannot be used in an object name because a semicolon is used to designate<br />
the end of a <strong>Teradata</strong> T<strong>Pump</strong> command.<br />
• 30 bytes cannot be used as the quoted object name length.<br />
• An ampersand (&) cannot be used in an object name.<br />
See Appendix A: “How to Read Syntax Diagrams” for more information about how to read<br />
the syntax diagrams used in this book.<br />
Geospatial <strong>Data</strong> Restrictions<br />
The following rules apply to Geospatial data:<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 89
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
Syntax Notes<br />
• <strong>Teradata</strong> T<strong>Pump</strong> does not support Geospatial data represented by LOBs.<br />
• <strong>Teradata</strong> T<strong>Pump</strong> does not support geospatial data beyond 64000.<br />
Large Decimal and BIGINT Restrictions<br />
The following restrictions apply to Large Decimal and BIGINT:<br />
• Nullif and apply-where clause support includes Large Decimal. BIGINT is not included.<br />
• SET and ACCEPT commands cannot assign and accept Large Decimal and BIGINIT<br />
values.<br />
• Serialization on Large Decimal and BIGINT fields is not recommended.<br />
<strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
Table 24 is an alphabetical list of the commands supported by <strong>Teradata</strong> T<strong>Pump</strong>. The syntax<br />
and use of these commands is described in detail in this chapter.<br />
Table 24: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
Command<br />
ACCEPT<br />
BEGIN LOAD<br />
DATEFORM<br />
DISPLAY<br />
DML<br />
ELSE<br />
ENDIF<br />
END LOAD<br />
FIELD<br />
FILLER<br />
Definition<br />
Accepts the data type and value of one or more utility variables from an external<br />
source.<br />
Indicates the start of a <strong>Teradata</strong> T<strong>Pump</strong> task and specifies the parameters for<br />
executing the task.<br />
Defines the form of the DATE data type specifications for the <strong>Teradata</strong> T<strong>Pump</strong><br />
job.<br />
Writes messages to the specified destination.<br />
Defines a label and error treatment option for the <strong>Teradata</strong> SQL DML<br />
statement(s) following the DML command. INSERT, UPDATE, DELETE, and<br />
EXECUTE are the DML statement options.<br />
The ELSE command is followed by commands and statements that execute<br />
when the preceding IF command is false. See IF, ELSE, and ENDIF.<br />
Exits from the conditional expression IF or IF/ELSE command sequences.<br />
ENDIF is followed by commands and statements resuming the program. See IF,<br />
ELSE, and ENDIF.<br />
Indicates completion of <strong>Teradata</strong> T<strong>Pump</strong> command entries and initiates the<br />
task. This is the last command of a <strong>Teradata</strong> T<strong>Pump</strong> task.<br />
Defines a field of the data source record. Fields specified by this command are<br />
sent to <strong>Teradata</strong> <strong>Data</strong>base. This command is used with the LAYOUT<br />
command.<br />
Defines a field in the data source that is not sent to <strong>Teradata</strong> <strong>Data</strong>base. This<br />
command is used with the LAYOUT command.<br />
90 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
Syntax Notes<br />
Table 24: <strong>Teradata</strong> T<strong>Pump</strong> Commands (continued)<br />
Command<br />
IF<br />
IMPORT<br />
LAYOUT<br />
LOGOFF<br />
LOGON<br />
LOGTABLE<br />
NAME<br />
PARTITION<br />
ROUTE<br />
RUN FILE<br />
SET<br />
SYSTEM<br />
TABLE<br />
Definition<br />
The IF command is followed by a conditional expression which, if true, executes<br />
commands and statements following the IF command. See IF, ELSE, and<br />
ENDIF.<br />
Identifies the data source, layout, and optional selection criteria to the client<br />
program.<br />
Specifies layout of the externally stored data records to be used in the <strong>Teradata</strong><br />
T<strong>Pump</strong> task. This command is used in conjunction with an immediately<br />
following sequence of FIELD, FILLER, and TABLE commands.<br />
Disconnects all active sessions and terminates execution of <strong>Teradata</strong> T<strong>Pump</strong> on<br />
the client.<br />
Establishes a <strong>Teradata</strong> SQL session on <strong>Teradata</strong> <strong>Data</strong>base, and specifies the<br />
LOGON string to be used in connecting all sessions required by subsequent<br />
functions.<br />
Identifies the table to be used for journaling checkpoint information required<br />
for safe, automatic restart of <strong>Teradata</strong> T<strong>Pump</strong> in the event of a client or <strong>Teradata</strong><br />
<strong>Data</strong>base failure.<br />
Sets the utility variable &SYSJOBNAME with a job name of up to 16 characters.<br />
Establishes session partitions to transfer SQL requests to <strong>Teradata</strong> <strong>Data</strong>base.<br />
Identifies the destination of output produced by <strong>Teradata</strong> T<strong>Pump</strong>.<br />
Invokes the specified external source as the current source of commands and<br />
statements.<br />
Assigns a data type and a value to a utility variable.<br />
Suspends <strong>Teradata</strong> T<strong>Pump</strong> to issue commands to the local operating system.<br />
Identifies a table whose column names and data descriptions are used as the<br />
names and data descriptions of the input record fields. Used in place of, or in<br />
addition to, the FIELD command. This command is used with the LAYOUT<br />
command.<br />
Note: When UTF-16 session character set is used, the TABLE command will<br />
generate a field of CHAR(2n) for the CHAR(n) typed column and a field of<br />
VARCHAR(2m) for the VARCHAR(m) typed column because each character in<br />
the column takes 2-byte storage when using UTF-16 session character set.<br />
<strong>Teradata</strong> T<strong>Pump</strong> <strong>Teradata</strong> SQL Statements<br />
The following <strong>Teradata</strong> SQL statements supported by <strong>Teradata</strong> T<strong>Pump</strong> are included in this<br />
chapter because they require special considerations for use with <strong>Teradata</strong> T<strong>Pump</strong>. They are<br />
used for loading purposes and for creating <strong>Teradata</strong> T<strong>Pump</strong> macros. The syntax and use of<br />
these <strong>Teradata</strong> SQL statements is described in detail in this chapter.<br />
Table 25 lists the <strong>Teradata</strong> SQL Statements supported by <strong>Teradata</strong> T<strong>Pump</strong>.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 91
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
Syntax Notes<br />
Table 25: <strong>Teradata</strong> T<strong>Pump</strong> <strong>Teradata</strong> SQL Statements<br />
Statement<br />
DATABASE<br />
DELETE<br />
EXECUTE<br />
INSERT<br />
UPDATE Statement and Atomic Upsert<br />
Definition<br />
Changes the default database qualification for all DML<br />
statements.<br />
Removes specified rows from a table.<br />
Specifies a user-created (predefined) macro for execution.<br />
The macro named in this statement resides in <strong>Teradata</strong><br />
<strong>Data</strong>base and specifies the type of DML statement<br />
(INSERT, UPDATE, or DELETE) being handled by the<br />
macro.<br />
Adds new rows to a table by directly specifying the row<br />
data to be inserted.<br />
Changes field values in existing rows of a table.<br />
92 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
ACCEPT<br />
ACCEPT<br />
Purpose<br />
The ACCEPT command accepts data types and values from an external source and uses them<br />
to set one or more utility variables. The ACCEPT command is a valid command preceding<br />
LOGON and LOGTABLE commands.<br />
Syntax<br />
,<br />
.ACCEPT<br />
var<br />
FILE<br />
fileid<br />
A<br />
FROM<br />
ENVIRONMENT<br />
VARIABLE<br />
B<br />
ENV<br />
VAR<br />
A<br />
;<br />
IGNORE<br />
charpos1<br />
charpos1<br />
THRU<br />
THRU<br />
charpos2<br />
charpos1<br />
THRU<br />
charpos2<br />
B<br />
env_var<br />
;<br />
HE03B011<br />
where<br />
Syntax Element<br />
var<br />
env_var<br />
Description<br />
Name of the utility variable that is to be set with the value accepted<br />
from the designated source<br />
Character string values appear as quoted strings in the data file.<br />
Environment variable that provides the value for the specified utility<br />
variables (var)<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 93
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
ACCEPT<br />
Syntax Element<br />
fileid<br />
charpos1 and charpos2<br />
Description<br />
<strong>Data</strong> source of the external system.<br />
The external system DD (or similar) statement specifies a file.<br />
UNIX and Windows<br />
infilename (the path name for a file).<br />
If the path name has embedded white space characters, enclose the<br />
entire path name in single or double quotes.<br />
z/OS<br />
a true DDNAME.<br />
If DDNAME is specified, <strong>Teradata</strong> T<strong>Pump</strong> reads data records from<br />
the specified source.<br />
A DDNAME must obey the same rules for its construction as<br />
<strong>Teradata</strong> SQL column names, except that:<br />
• the “at” sign (@) is allowed as an alphabetic character<br />
• the underscore (_) is not allowed<br />
The DDNAME must also obey the applicable rules of the external<br />
system.<br />
If DDNAME represents a data source on magnetic tape, the tape<br />
may be either labelled or nonlabelled (if the operating system<br />
supports it).<br />
Start and end character positions of a field in each input record<br />
which contains extraneous information<br />
<strong>Teradata</strong> T<strong>Pump</strong> ignores the specified field(s) as follows:<br />
• If charpos1 is specified, <strong>Teradata</strong> T<strong>Pump</strong> ignores only the single<br />
specified character position.<br />
• If charpos1 THRU character positions are specified, <strong>Teradata</strong><br />
T<strong>Pump</strong> ignores character positions from charpos1 through the<br />
end of the record.<br />
• If THRU charpos2 is specified, <strong>Teradata</strong> T<strong>Pump</strong> ignores character<br />
positions from the beginning of the record through charpos2.<br />
• If charpos1 THRU charpos2 is specified, <strong>Teradata</strong> T<strong>Pump</strong> ignores<br />
character positions from charpos1 through charpos2.<br />
Usage Notes<br />
A single record, row, or input line is accepted from the designated source. Ensure that there is<br />
only one record in the file from which the ACCEPT command is getting the variables.<br />
If multiple variables are coded, each is sequentially assigned input text up to the first white<br />
space character encountered that is not within a quoted string.<br />
Input text for numeric values must be delimited only by white space or record boundaries.<br />
Input text for character strings must be enclosed in apostrophes. For example:<br />
.Accept age, name from file info;<br />
94 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
ACCEPT<br />
The data record provided to satisfy the preceding ACCEPT should include two fields. The<br />
following example shows two sample data records, where the first is correct but the next is not:<br />
32 'Tom' /* This line contains valid data. */<br />
32 Tom /* Tom is invalid data. */<br />
An additional method of placing comments in input text is as follows:<br />
32 'Tom'; This line contains valid data.<br />
When the number of variables listed is greater than the number of responses available, unused<br />
variables remain undefined (NULL). If there are not enough variables to hold all responses, a<br />
warning message is issued. If the input source is a file, the next record (starting with the first)<br />
of the file is always retrieved.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 95
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
BEGIN LOAD<br />
BEGIN LOAD<br />
Purpose<br />
The BEGIN LOAD command initiates or restarts a <strong>Teradata</strong> T<strong>Pump</strong> task, specifying the<br />
number of sessions to use and any other parameters needed to execute the task.<br />
Syntax<br />
.BEGIN LOAD<br />
SESSIONS<br />
number<br />
threshold<br />
A<br />
A<br />
ERRORTABLE<br />
tname<br />
dbname.<br />
ERRLIMIT errcount<br />
errpercent<br />
APPEND<br />
NODROP<br />
QUEUETABLE<br />
CHECKPOINT<br />
frequency<br />
SERIALIZE<br />
OFF<br />
ON<br />
DATAENCRYPTION<br />
OFF<br />
ON<br />
ARRAYSUPPORT OFF<br />
ON<br />
TENACITY hours<br />
PACK<br />
statements<br />
PACKMAXIMUM<br />
LATENCY seconds<br />
NOTIMERPROCESS<br />
RATE<br />
statement_rate<br />
RETRYTIMES<br />
nn<br />
SLEEP minutes<br />
NOATOMICUPSERT<br />
NOMONITOR<br />
ROBUST ON<br />
OFF<br />
MACRODB dbname<br />
NOTIFY<br />
OFF<br />
LOW<br />
MEDIUM<br />
HIGH<br />
ULTRA<br />
EXITname<br />
TEXT ' string '<br />
MSG ' string '<br />
3021G017<br />
96 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
BEGIN LOAD<br />
where<br />
Syntax Element<br />
SESSIONS<br />
number<br />
threshold<br />
ERRORTABLE<br />
APPEND<br />
NODROP<br />
QUEUETABLE<br />
Description<br />
Keyword for the number of <strong>Teradata</strong> T<strong>Pump</strong> sessions.<br />
Number of sessions to be logged on for update purposes for <strong>Teradata</strong><br />
T<strong>Pump</strong>.<br />
A <strong>Teradata</strong> T<strong>Pump</strong> task logs on and uses the number of sessions<br />
specified. One additional session is used for performing various utility<br />
functions.<br />
There is no default value for number; it must be specified. Neither is<br />
there a maximum value, except for system-wide session limitations,<br />
which vary among machines.<br />
Limiting the number of sessions conserves resources on both the<br />
external system and <strong>Teradata</strong> <strong>Data</strong>base. This conservation is at the<br />
expense of a potential decrease in throughput and increase in elapsed<br />
time.<br />
Minimum number of sessions to be logged on for update purposes for<br />
the utility.<br />
When logging on sessions, if the limits are reached above the threshold<br />
value, <strong>Teradata</strong> T<strong>Pump</strong> stops trying to log on, and uses whatever<br />
sessions are already logged on.<br />
If the sessions run out before the threshold is reached, <strong>Teradata</strong> T<strong>Pump</strong><br />
logs off all sessions, waits for the time determined by the SLEEP value,<br />
and tries to log on again.<br />
Optional keyword for identifying a database and error table.<br />
Use a database name as a qualifying prefix to the error tables. Specifying<br />
a database that is not the production database avoids cluttering the<br />
production system with error tables. This means that because the<br />
database should have been allocated a lot of PERM space, that space will<br />
not have to be increased for all databases with tables involved in the<br />
<strong>Teradata</strong> T<strong>Pump</strong> task.<br />
Caution: It is the user’s responsibility to ensure that the error table<br />
sharing was meaningful. Two jobs targeting different tables<br />
with different input record layouts cannot share the same<br />
error table.<br />
Specifies the existing error table.<br />
If the specified error table does not exist, <strong>Teradata</strong> T<strong>Pump</strong> will create it.<br />
If the structure of the existing error table is not compatible with the<br />
error table <strong>Teradata</strong> T<strong>Pump</strong> creates, the job will run into an error when<br />
<strong>Teradata</strong> T<strong>Pump</strong> tries to insert or update the error table.<br />
Specifies to retain (not DROP) the error table, even it is empty at the<br />
end of a job.<br />
NODROP can be used with APPEND to persist the error table or alone.<br />
Selects the error table as a Queue Table.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 97
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
BEGIN LOAD<br />
Syntax Element<br />
dbname.<br />
tname<br />
Description<br />
The qualified database for the error table.<br />
If the database is not specified, the database which contains the log table<br />
is used. The period following the dbname separates the database name<br />
from the tname parameter. If a different database is specified, it may<br />
help to avoid cluttering the production database with error tables.<br />
Error table that receives information about errors detected during the<br />
load.<br />
tname may be preceded by a database name qualifier. This table is<br />
referred to as the error table or ET table.<br />
<strong>Teradata</strong> T<strong>Pump</strong> does not explicitly specify the level of protection<br />
applied to this table, using instead the default protection level applied to<br />
the database wherein the error table is placed. If the database specifies<br />
fallback, tname becomes fallback.<br />
The default error table name is composed of the job name, followed by<br />
an underscore and sequence number of the load, then an underscore<br />
and an ET, as in jobname_nnn_ET.<br />
tname identifies a nonexisting table for a nonrestart task, or an existing<br />
table for a restart task.<br />
For all errors inserted in this error table, the identifiers for the offending<br />
combination of statement and data record are included in the<br />
appropriate row of tname. The columns in the error table allow the<br />
identification of a specific data record and statement combination<br />
which produced an error. The column names and definitions of the<br />
error table are:<br />
ImportSeq—A byteint containing the IMPORT command sequence<br />
number.<br />
DMLSeq —A byteint containing the sequence number of the DML<br />
command within the command file.<br />
SMTSeq—A byteint containing the sequence number of the DML<br />
statement within the DML command.<br />
ApplySeq—A byteint containing the sequence number of the APPLY<br />
clause within its IMPORT command.<br />
SourceSeq—An integer containing the position of a data record within a<br />
data source.<br />
<strong>Data</strong>Seq—A byteint identifying the data source. This value is always<br />
one.<br />
ErrorCode —An integer containing an error return code.<br />
ErrorMsg—Contains the corresponding error message for the error<br />
code.<br />
ErrorField —A smallint, which, if valid, indicates the bad field.<br />
The names of record fields sent to <strong>Teradata</strong> <strong>Data</strong>base are specified via<br />
the LAYOUT command, in conjunction with FIELD and TABLE<br />
commands.<br />
Host<strong>Data</strong> - A variable length byte string containing the data sent by the<br />
external system.<br />
98 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
BEGIN LOAD<br />
Syntax Element<br />
ERRLIMIT<br />
errcount<br />
CHECKPOINT<br />
Description<br />
Optional keyword for setting a limit on records rejected for errors.<br />
When the ERRLIMIT is exceeded, <strong>Teradata</strong> T<strong>Pump</strong> performs a<br />
checkpoint, then terminates the job. The data read before ERRLIMIT<br />
was exceeded will be submitted and completed before the job is<br />
terminated. This means when a job is terminated due to ERRLIMIT was<br />
exceeded, there may be more error records in the error table than the<br />
number specified in ERRLIMIT. To facilitate diagnosis of data errors,<br />
the ERRLIMIT should be greater than the number of statements packed<br />
into one request.<br />
Error threshold for controlling the number of rejected records. Usage<br />
depends on whether used with the errpercent parameter.<br />
• When used without the errpercent parameter, specifies, as an<br />
unsigned integer, the number of records that can be rejected and<br />
recorded in tname during a load (all records sent between the BEGIN<br />
LOAD and END LOAD commands). The default is no limit.<br />
• When used with the errpercent parameter (which is approximate),<br />
specifies the maximum number of records that must be sent to<br />
<strong>Teradata</strong> <strong>Data</strong>base before the errpercent parameter is applied.<br />
For example, if errcount = 100 and errpercent = 5, then 100 records must<br />
be sent to <strong>Teradata</strong> <strong>Data</strong>base before the approximate 5 percent rejection<br />
limit is applied. If only the first five records are rejected when the 100th<br />
record is sent, the limit is not exceeded. If there are six rejections,<br />
however, then the limit is exceeded. After the 100th record is sent,<br />
<strong>Teradata</strong> T<strong>Pump</strong> stops processing if the 5 percent limit has been<br />
exceeded.<br />
When the limit has been exceeded, <strong>Teradata</strong> T<strong>Pump</strong> writes an error<br />
message to the external system’s customary message destination and<br />
terminates the task.<br />
All tables in use are left in their state at the time of the termination. This<br />
allows errors to be corrected in data records and restarting of the task<br />
from the last checkpoint. If a restart is not possible or not desired, any<br />
unwanted tables should be dropped.<br />
Keyword indicating the number of minutes between the occurrences of<br />
checkpoints.<br />
This is followed by a frequency value.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 99
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
BEGIN LOAD<br />
Syntax Element<br />
frequency<br />
DATAENCRYPTION<br />
ON/OFF<br />
Description<br />
The interval in minutes between check pointing operations. Specify an<br />
unsigned integer from 0 through 60, inclusive.<br />
To specify a CHECKPOINT frequency of less than or equal to 60, a<br />
checkpoint is recorded at the specified frequency, in minutes.<br />
To specify a CHECKPOINT frequency of more than 60, <strong>Teradata</strong> T<strong>Pump</strong><br />
terminates the job.<br />
Specifying a CHECKPOINT frequency of zero bypasses all checkpoint<br />
functions. <strong>Teradata</strong> T<strong>Pump</strong> does not do checkpoint operations at all,<br />
which is different from <strong>Teradata</strong> Tools and Utilities 07.00 and earlier.<br />
The <strong>Teradata</strong> T<strong>Pump</strong> job will not be re-startable once data loading has<br />
begun.<br />
If a CHECKPOINT frequency is not specified, check pointing occurs<br />
every 15 minutes by default.<br />
Whether specified or not, checkpoints are written at the end of each<br />
data input source.<br />
Note: Checkpoints should not be set for an FDL-compatible INMOD<br />
routine with the FOR, FROM, or THRU options. When an<br />
FDL-compatible INMOD routine is used with the FOR, FROM, or<br />
THRU options, <strong>Teradata</strong> T<strong>Pump</strong> terminates and an error message<br />
appears if the checkpoint frequency is other than zero.<br />
Keyword to encrypt import data and the request text during the<br />
communication between <strong>Teradata</strong> T<strong>Pump</strong> and <strong>Teradata</strong> <strong>Data</strong>base.<br />
If ON, the encryption will be performed. If DATAENCRYPTION is not<br />
specified, the default is OFF.<br />
The "-y" runtime parameter applies the encryption to all connected<br />
sessions, which include the control session and the load sessions. This<br />
option only applies the encryption to the load sessions, which are the<br />
sessions specified by the SESSIONS keyword in the BEGIN LOAD<br />
command, and overrides the "-y" runtime parameter when OFF is<br />
explicitly specified. For example, assuming the PARTITION command<br />
is not used in the job, when "-y" runtime parameter is specified with the<br />
job and DATAENCRYPTION OFF is specified in the script, the<br />
encryption will only apply to the control session. Similarly, assuming<br />
the PARTITION command is not used in the job when "-y" runtime<br />
parameter is not specified with the job, and DATAENCRYPTION ON is<br />
specified in the script, the encryption will apply to all load sessions but<br />
not the control session.<br />
When the PARTITION command is used, the encryption setting<br />
explicitly specified in the PARTITION command will override the<br />
setting of this option over the sessions defined by the PARTITION<br />
command.<br />
100 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
BEGIN LOAD<br />
Syntax Element<br />
ArraySupport<br />
ON/OFF<br />
TENACITY<br />
hours<br />
Description<br />
“ArraySupport ON|OFF” option to the .BEGIN LOAD command and<br />
the .DML command.<br />
When “ArraySupport ON” is specified in the .BEGIN LOAD command,<br />
the .DML commands enclosed in .BEGIN LOAD and .END LOAD<br />
command pair will use the ArraySupport feature for its DML statement,<br />
unless “ArraySupport OFF” is specified for the .DML command. The<br />
default value of ArraySupport for the .BEGIN LOAD command is OFF.<br />
When “ArraySupport ON|OFF” is not specified with the .DML<br />
command, the default value for ArraySupport for that .DML command<br />
is the effective setting of ArraySupport in the .BEGIN LOAD command<br />
where the .DML command resides. When “ArraySupport ON|OFF” is<br />
specified at the .DML command, the specified value overrides the<br />
default setting determined by the .BEGIN LOAD command.<br />
When a .DML command is using the ArraySupport feature, it must<br />
contain one and only one DML statement, and the session partition that<br />
the .DML command references needs to be used by this .DML<br />
command exclusively.<br />
If the DML statement is an UPSERT-type statement, it can be specified<br />
as a pair of INSERT/UPDATE statements with DO INSERT FOR<br />
MISSING UPDATE clause. <strong>Teradata</strong> T<strong>Pump</strong> will create its equivalent<br />
form of UPDATE … ELSE INSERT …, example Atomic Upsert, and use<br />
it as the actual DML statement. Or an UPDATE … ELSE INSERT …<br />
statement can be directly specified with DO INSERT FOR MISSING<br />
UPDATE clause.<br />
The non-atomic form of UPSERT is not supported by <strong>Teradata</strong> T<strong>Pump</strong><br />
Array Support.<br />
Keyword (with hours parameter) defining how long the utility tries to<br />
log on the sessions needed to perform the <strong>Teradata</strong> T<strong>Pump</strong> job.<br />
If a logon is denied, <strong>Teradata</strong> T<strong>Pump</strong> delays for the time specified by the<br />
SLEEP parameter (the default is six minutes) and retries the logon. It<br />
retries until either the logon succeeds or the number of hours specified<br />
by TENACITY is exceeded.<br />
If the TENACITY parameter is not specified, the utility retries the<br />
logons for four hours.<br />
<strong>Teradata</strong> T<strong>Pump</strong> tenacity factor, as an integral number of hours.<br />
Specifies how long <strong>Teradata</strong> T<strong>Pump</strong> keeps trying to logon to the<br />
required sessions.<br />
The default value for hours is 4 if the parameter is not specified. If hours<br />
is specified as 0, <strong>Teradata</strong> T<strong>Pump</strong> does not retry logons after a logon<br />
fails because of a capacity limit.<br />
When a “no more sessions” error appears (either a 301 return code from<br />
a workstation CLI or a 513 return code from a mainframe CLI),<br />
<strong>Teradata</strong> T<strong>Pump</strong> drops the sessions already acquired, and terminates the<br />
job without trying another logon.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 101
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
BEGIN LOAD<br />
Syntax Element<br />
LATENCY<br />
seconds<br />
NOTIMERPROCESS<br />
minutes<br />
SERIALIZE ON/OFF<br />
PACKMAXIMUM<br />
Description<br />
Keyword for flushing stale buffers.<br />
Note: When using the <strong>Teradata</strong> T<strong>Pump</strong> latency option with Named<br />
Pipe Access Module, need_full_block = no option should be added in the<br />
Named Pipe Access Module initialization string.<br />
Flushing threshold based on number of seconds oldest record has<br />
resided in buffer.<br />
LATENCY cannot be less than one second.<br />
If the SERIALIZE parameter is set to OFF, only the current buffer can<br />
possibly be stale. If SERIALIZE is ON, the number of stale buffers can<br />
range from zero to the number of sessions.<br />
Keyword to tell <strong>Teradata</strong> T<strong>Pump</strong> not to fork a child process as a timer<br />
process.<br />
When a child process is forked, the SIGUSR2 signal notifies the parent<br />
process when the latency period expires. When a child process is not<br />
forked, the SIGALRM signal notifies the <strong>Teradata</strong> T<strong>Pump</strong> process when<br />
the latency period expires. A child process is necessary for the latency<br />
function to work properly on the UNIX platforms when the MQSeries<br />
Access Module is used.<br />
Number of minutes to wait between unsuccessful logon attempts due to<br />
session limits errors on <strong>Teradata</strong> <strong>Data</strong>base or CLIv2.<br />
If SLEEP is not specified, the default between unsuccessful logon<br />
attempts is 6 minutes.<br />
Keyword to set the state (ON/OFF) of the serialization feature which, if<br />
ON, guarantees that operations on a given key combination (row) occur<br />
serially.<br />
If SERIALIZE is not specified, the default is OFF.<br />
This feature is meaningful only when a primary key for the loaded data<br />
is specified by using the KEY option of the FIELD command.<br />
Serialization must be set to OFF if the .TABLE command is used and the<br />
target table is a NoPI table.<br />
To ensure data integrity, the SERIALIZE parameter defaults to ON in<br />
the absence of an explicit value if there are upserts in a <strong>Teradata</strong> T<strong>Pump</strong><br />
job.<br />
Keyword requesting <strong>Teradata</strong> T<strong>Pump</strong> to dynamically determine the<br />
maximum possible PACK factor for the current load.<br />
Maximum value is 2430.<br />
Displayed in message UTY6652, the value thus determined should be<br />
specifically used on subsequent runs, as the use of PACKMAXIMUM<br />
requires iterative interactions with the database during initialization to<br />
heuristically determine the maximum possible PACK factor.<br />
Note: Since the maximum packing factor has changed from 600 to<br />
2430, it will take a longer time for <strong>Teradata</strong> T<strong>Pump</strong> to test the packing<br />
factor if PACKMAXIMUM is specified.<br />
102 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
BEGIN LOAD<br />
Syntax Element<br />
PACK<br />
statements<br />
RATE<br />
RETRYTIMES nn<br />
Description<br />
Keyword for the number of statements to pack into a multiplestatement<br />
request.<br />
Maximum value is 2430.<br />
Packing improves network/channel efficiency by reducing the number<br />
of sends and receives between the application and <strong>Teradata</strong> <strong>Data</strong>base.<br />
Number of statements, as a positive integer of up to 2430, to pack into a<br />
multiple-statement request.<br />
Default value is 20 statements per request.<br />
Under certain conditions, <strong>Teradata</strong> T<strong>Pump</strong> may determine that the pack<br />
factor has been set too high. <strong>Teradata</strong> T<strong>Pump</strong> then automatically lowers<br />
the pack setting to an appropriate value and issues warning message<br />
UTY6625, for instance:<br />
“UTY6625 WARNING: Packing has been changed to 12 statements per<br />
request” and continues.<br />
Packing improves network/channel efficiency by reducing the number<br />
of sends/receives between the application and the database.<br />
The packing factor is validated by sending a fully packed request to<br />
<strong>Teradata</strong> <strong>Data</strong>base using a prepare. This test checks for syntax problems<br />
and requests that are excessively large and may overwhelm the parser.<br />
To simplify the script development process, <strong>Teradata</strong> T<strong>Pump</strong> ignores<br />
certain errors returned by an overloaded parser, shrinks the request,<br />
retries the prepare until it executes successfully and finally, issues a<br />
warning noting the revised packing factor size.<br />
When this happens, the <strong>Teradata</strong> T<strong>Pump</strong> script should be modified to<br />
eliminate the warning, thereby avoiding the time-consuming process of<br />
shrinking the request.<br />
A packing failure may occur if the source parcel length does not match<br />
the data defined. If this happens, <strong>Teradata</strong> T<strong>Pump</strong> issues the message:<br />
“UTY2819 WARNING: Packing may fail because input data does not<br />
match with the data defined.”<br />
To resolve this problem, increase the packing factor and resubmit the<br />
job.<br />
Keyword for entering the rate at which statements are sent to <strong>Teradata</strong><br />
<strong>Data</strong>base.<br />
Keyword for retry times number of retry times.<br />
Default is 16.<br />
If nn equals 0, the retry times will be set to 16. If retrytimes is set, this<br />
only takes effect for the requests/data between "BEGIN LOAD" and<br />
"END LOAD" pair.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 103
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
BEGIN LOAD<br />
Syntax Element<br />
statement_rate<br />
Description<br />
Initial maximum rate at which statements are sent to <strong>Teradata</strong> <strong>Data</strong>base<br />
per minute.<br />
The statement rate must be a positive integer. If the statement rate is<br />
unspecified, the rate is unlimited.<br />
If the statement_ rate is less than the statement packing factor, <strong>Teradata</strong><br />
T<strong>Pump</strong> sends requests smaller than the packing factor.<br />
If the <strong>Teradata</strong> T<strong>Pump</strong> Monitor is in use, the statement_rate can be<br />
changed later on.<br />
SLEEP<br />
NOATOMICUPSERT<br />
NOMONITOR<br />
ROBUST ON/OFF<br />
Keyword for the number of minutes to sleep.<br />
Keyword to perform non-atomic upsert operations for UPSERT DMLs<br />
in the job script if these UPSERT DMLs are not provided in the Atomic<br />
UPSERT form.<br />
Keyword to prevent <strong>Teradata</strong> T<strong>Pump</strong> from checking for statement rate<br />
changes from, or update status information for, the <strong>Teradata</strong> T<strong>Pump</strong><br />
Monitor.<br />
The ON parameter ensures data integrity when target tables have<br />
identity columns.<br />
The OFF parameter signals <strong>Teradata</strong> T<strong>Pump</strong> to use simple restart logic.<br />
In this case, restarts cause <strong>Teradata</strong> T<strong>Pump</strong> to begin where the last<br />
checkpoint occurred in a job. Any processing that occurred after the<br />
checkpoint is redone. This method does not have the extra overhead of<br />
the additional database writes in the Robust logic.<br />
Caution: Certain errors may cause reprocessing, resulting in extra<br />
error table rows due to reexecuting statements (attempting to<br />
re-insert rows, for example). Or, if the target table allows<br />
duplicate rows, reexecuting statements may cause extra<br />
duplicate rows to be inserted into the target table instead of<br />
causing extra error table rows.<br />
Simple logic is adequate in certain DML statements that can be repeated<br />
without changing the results of the operation. Examples of statements<br />
that are not simple logic include the following:<br />
• INSERTs into tables that allow duplicate rows (MULTISET tables).<br />
• Self-referencing DML statements such as:<br />
• “UPDATE FOO SET A=A+1...”<br />
• “UPDATE FOO SET A = 3 WHERE A=4”<br />
MACRODB<br />
dbname<br />
Keyword for database to contain any macros used by <strong>Teradata</strong> T<strong>Pump</strong>.<br />
Name of database which is to contain any macros built/used by <strong>Teradata</strong><br />
T<strong>Pump</strong>.<br />
This database overrides the default placement of macros into the<br />
database which contains the log restart table.<br />
104 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
BEGIN LOAD<br />
Syntax Element<br />
NOTIFY<br />
EXIT name<br />
TEXT 'string'<br />
MSG 'string'<br />
Description<br />
<strong>Teradata</strong> T<strong>Pump</strong> implementation of the notify user exit option:<br />
• NOTIFY OFF suppresses the notify user exit option.<br />
• NOTIFY LOW enables the notify user exit option for those events<br />
signified by “Yes” in the Low Notification Level column of Table 26.<br />
• NOTIFY MEDIUM enables the notify user exit option for the most<br />
significant events, as specified by “Yes” in the Medium Notification<br />
Level column of Table 26.<br />
• NOTIFY HIGH enables the notify user exit option for every <strong>Teradata</strong><br />
T<strong>Pump</strong> event that involves an operational decision point, as<br />
specified by “Yes” in the High Notification Level column of Table 26.<br />
• NOTIFY ULTRA enables the notify user exit option for every<br />
<strong>Teradata</strong> T<strong>Pump</strong> event that involves an operational decision point, as<br />
specified by “Yes” in the ULTRA Notification Level column of<br />
Table 26.<br />
Keyword phrase that calls a user-defined exit where name is the name of<br />
a user-supplied library with a member name of _dynamn.<br />
The default library names are:<br />
• NOTFYEXT for channel-attached z/OS client systems<br />
• libnotfyext.so for network-attached UNIX and Windows client<br />
systems<br />
The exit must be written in C, or in a language with a runtime<br />
environment that is compatible with C.<br />
On some versions of UNIX, ./prefix characters may have to be added to<br />
the EXIT name specification if the module is in the current directory.<br />
User-supplied string of up to 80 characters that <strong>Teradata</strong> T<strong>Pump</strong> passes<br />
to the named exit routine.<br />
The string specification must be enclosed in single quote characters (').<br />
User-supplied string of up to 16 characters that <strong>Teradata</strong> T<strong>Pump</strong> logs to:<br />
• The operator’s console for channel-attached z/OS client systems<br />
• The system log for network-attached UNIX and Windows client<br />
systems<br />
The string specification must be enclosed in single quote characters (').<br />
Table 26 lists events that create notifications.<br />
Table 26: Events that Create Notifications<br />
Notification Level<br />
Event Low Medium High Ultra Signifies<br />
Checkpoint Begin No No Yes Yes <strong>Teradata</strong> T<strong>Pump</strong> started a<br />
checkpoint.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 105
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
BEGIN LOAD<br />
Table 26: Events that Create Notifications (continued)<br />
Notification Level<br />
Checkpoint End No No Yes Yes <strong>Teradata</strong> T<strong>Pump</strong> successfully<br />
completed a checkpoint.<br />
CLIv2 Error Yes Yes Yes Yes <strong>Teradata</strong> T<strong>Pump</strong> received a CLIv2<br />
error.<br />
<strong>Data</strong>base Error Yes Yes Yes Yes A <strong>Teradata</strong> <strong>Data</strong>base error that<br />
terminates <strong>Teradata</strong> T<strong>Pump</strong>.<br />
DML Error No No Yes Yes <strong>Teradata</strong> T<strong>Pump</strong> is about to log a<br />
DML error to the error table.<br />
Error Table No No Yes Yes Successful processing of the SEL<br />
COUNT(*) request for the error<br />
table.<br />
Exit Yes Yes Yes Yes <strong>Teradata</strong> T<strong>Pump</strong> completed a load<br />
task.<br />
File or INMOD Open No No Yes Yes Successful processing of the<br />
IMPORT command.<br />
Import Begin No No Yes Yes <strong>Teradata</strong> T<strong>Pump</strong> is about to start<br />
reading records.<br />
Import End No No Yes Yes Last record has been read.<br />
Initialize Yes Yes Yes Yes Successful processing of the Notify<br />
option (BEGIN LOAD command)<br />
Interim Run Statistics No No No Yes <strong>Teradata</strong> T<strong>Pump</strong> is about to update<br />
the Monitor Interface table, or<br />
<strong>Teradata</strong> T<strong>Pump</strong> successfully<br />
completed a checkpoint, or an<br />
Import has just completed<br />
successfully.<br />
Table Statistics No Yes Yes Yes <strong>Teradata</strong> T<strong>Pump</strong> has successfully<br />
written the table statistics.<br />
<strong>Teradata</strong> <strong>Data</strong>base<br />
Restart<br />
No Yes Yes Yes <strong>Teradata</strong> T<strong>Pump</strong> received a crash<br />
error from <strong>Teradata</strong> or CLI.<br />
Usage Notes<br />
Multiple tables can be targeted by a single <strong>Teradata</strong> T<strong>Pump</strong> job.<br />
If the script author is uncertain whether or not to use ROBUST restart logic, it is always safe to<br />
use the ROBUST ON parameter.<br />
To ensure data integrity, the SERIALIZE parameter defaults to ON in the absence of an<br />
explicit value if there are upserts in the <strong>Teradata</strong> T<strong>Pump</strong> job.<br />
The statement rate per minute you set using the RATE keyword is also affected by the<br />
periodicity value. By default, <strong>Teradata</strong> T<strong>Pump</strong> uses a periodicity value of four when enforcing<br />
106 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
BEGIN LOAD<br />
the statement rate limit. You can adjust the periodicity rate from 1 to 2430 using a run-time<br />
parameter.<br />
For example, if you set the statement rate at 1600 and the periodicity at 10, then the maximum<br />
number of statements processed is 160 (1600/10) statements every 6 (60/10) seconds.<br />
Caution:<br />
A LOGOFF command entered after a BEGIN and before the matching END LOAD logs you<br />
off the <strong>Teradata</strong> T<strong>Pump</strong> utility.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 107
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DATABASE<br />
DATABASE<br />
Purpose<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports the <strong>Teradata</strong> SQL DATABASE statement, which changes the default<br />
database qualification for all unqualified DML and DDL statements.<br />
Syntax<br />
DATABASE database<br />
;<br />
3021A020<br />
where<br />
Syntax Element<br />
database<br />
Description<br />
New qualified default database for the error table<br />
Changes the database from the one originally specified by the BEGIN<br />
LOAD command.<br />
Usage Notes<br />
The DATABASE command only affects native SQL commands. In particular, it has no effect<br />
on the BEGIN LOAD command.<br />
The DATABASE command does affect INSERT, UPDATE, DELETE, and EXEC statements<br />
issued as part of a load. (When <strong>Teradata</strong> T<strong>Pump</strong> logs on sessions, it immediately issues a<br />
DATABASE statement on each session.)<br />
The DATABASE command does not affect the placement of <strong>Teradata</strong> T<strong>Pump</strong> macros.<br />
108 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DATEFORM<br />
DATEFORM<br />
Purpose<br />
The DATEFORM command lets you define the form of the DATE data type specifications for<br />
the <strong>Teradata</strong> T<strong>Pump</strong> job.<br />
Syntax<br />
.DATEFORM<br />
INTEGERDATE<br />
ANSIDATE<br />
;<br />
3021A006<br />
where<br />
Syntax Element<br />
INTEGERDATE<br />
ANSIDATE<br />
Description<br />
Keyword that specifies integer DATE data types for the <strong>Teradata</strong> T<strong>Pump</strong><br />
job<br />
This is the default <strong>Teradata</strong> DATE data type specification for <strong>Teradata</strong><br />
T<strong>Pump</strong> jobs if you do not enter a DATEFORM command.<br />
Keyword that specifies ANSI fixed-length CHAR(10) DATE data types for<br />
the <strong>Teradata</strong> T<strong>Pump</strong> job<br />
Usage Notes<br />
Table 27 describes the things to consider when using the DATEFORM command.<br />
Table 27: DATEFORM Command Usage Notes<br />
Topic<br />
Command Frequency<br />
and Placement<br />
<strong>Data</strong> Type Conversions<br />
Usage Notes<br />
• Only one DATEFORM command can be used.<br />
• The DATEFORM command must be entered before LOGON<br />
command.<br />
When the ANSIDATE specification is used, the ANSI/SQL DateTime data<br />
types must be converted to fixed-length CHAR data types when specifying<br />
the column/field names in the <strong>Teradata</strong> T<strong>Pump</strong> FIELD command.<br />
See the Usage Notes subsection of the FIELD command for a description<br />
of the fixed-length CHAR representations for each DATE, TIME,<br />
TIMESTAMP, and INTERVAL data type specification.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 109
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DATEFORM<br />
Table 27: DATEFORM Command Usage Notes (continued)<br />
Topic<br />
Release Applicability<br />
Usage Notes<br />
The ANSIDATE specification is valid for <strong>Teradata</strong> T<strong>Pump</strong> jobs on <strong>Teradata</strong><br />
<strong>Data</strong>base for UNIX.<br />
110 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DELETE<br />
DELETE<br />
Purpose<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports the DELETE <strong>Teradata</strong> SQL statement, which removes rows from a<br />
table.<br />
Syntax<br />
DELETE tname WHERE conditional<br />
;<br />
FROM<br />
HE05B032<br />
where<br />
Syntax Element<br />
tname<br />
WHERE<br />
condition<br />
Description<br />
Table from which rows are to be deleted<br />
tname is qualified either explicitly by database name, or by the current default<br />
database.<br />
Conditional clause identifying the row(s) to delete<br />
The conditional clause uses values from input data record fields as defined by a<br />
FIELD command or TABLE command of the layout referenced by an IMPORT<br />
using this statement.<br />
Usage Notes<br />
The following notes describe how to use DELETE statements following a DML command.<br />
A DELETE statement may also be used in the support environment; normal rules for DELETE<br />
are followed in that case.<br />
<strong>Teradata</strong> T<strong>Pump</strong> operates only on single table statements so DELETE statements must not<br />
contain any joins.<br />
To delete records from a table, the username specified on the LOGON command must have<br />
DELETE privilege on the specified table.<br />
When the condition(s) of the DELETE statement WHERE clause are evaluated, the result can<br />
be definitely true, definitely false, or indeterminate. If the result is true for a specific row,<br />
<strong>Teradata</strong> T<strong>Pump</strong> deletes the row. An indeterminate result, due to an abnormal arithmetic<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 111
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DELETE<br />
condition such as underflow, overflow, or division by zero, is treated as an error, and <strong>Teradata</strong><br />
T<strong>Pump</strong> records both row and error code in the error table.<br />
The DELETE statement must identify only one object.<br />
Remember the following when constructing scripts:<br />
• A DELETE statement can be applied to either a table or view, provided that the view does<br />
not specify a join.<br />
• Equality values for all the primary index columns should normally be specified in the<br />
WHERE clause.<br />
The OR construct can be used in the WHERE clause of a DELETE statement; alternatively,<br />
two or more separate DML statements (one per OR term) can be used, with the DML<br />
statements applied conditionally with the APPLY clause of the IMPORT command. The<br />
nature of the alternatives will usually make one of the methods more appropriate.<br />
• The column(s) specified in this clause need not be a part of any index, but can be one or<br />
more nonindexed columns. This clause may specify nonequality values for any<br />
combination of columns of unique indices, or any values for other columns.<br />
• The maximum number of INSERT, UPDATE, and DELETE statements that can be<br />
referenced in an IMPORT is 128. The 128th DML which would cause the insertion of the<br />
DML sequence number of 128 for the DMLSEQ field in the error table could lead to<br />
<strong>Teradata</strong> <strong>Data</strong>base 3520 error.<br />
• The maximum number of DML statements that can be packed into a request is 2430. The<br />
default number of statements packed is 20.<br />
DML validtime qualifier and NONTEMPORAL semantics are supported. For more<br />
information, see SQL <strong>Data</strong> Manipulation Language and SQL <strong>Data</strong> Manipulation Language<br />
Advanced Topics.<br />
Example<br />
The following example uses an input data source containing a series of one-field, four-byte<br />
records. Each record contains the value (EmpNum) of the primary index column (EmpNo) of<br />
a row to be deleted from the Employee table.<br />
.BEGIN LOAD SESSION number;<br />
.LAYOUT Layoutname;<br />
.FIELD EmpNum 1 INTEGER;<br />
.DML LABEL DMLlabelname;<br />
DELETE Employee WHERE EmpNo = :EmpNum;<br />
.IMPORT INFILE Infilename LAYOUT Layoutname APPLY DMLlabelname;<br />
.END LOAD;<br />
112 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DISPLAY<br />
DISPLAY<br />
Purpose<br />
The DISPLAY command can be used to write messages to the specified destination.<br />
Syntax<br />
DISPLAY<br />
'text'<br />
FILE<br />
fileid<br />
;<br />
TO<br />
3021A021<br />
where<br />
Syntax Element<br />
'text'<br />
fileid<br />
Description<br />
Text to be written to the specified output destination<br />
<strong>Data</strong> source of the external system.<br />
The external system DD (or similar) statement specifies a file.<br />
UNIX and Windows<br />
infilename (the path name for a file)<br />
If the path name has embedded white space characters, enclose the<br />
entire path name in single or double quotes.<br />
z/OS<br />
a true DDNAME.<br />
If DDNAME is specified, <strong>Teradata</strong> T<strong>Pump</strong> reads data records from<br />
the specified source.<br />
A DDNAME must obey the same rules for its construction as<br />
<strong>Teradata</strong> SQL column names, except that:<br />
• the “at” sign (@) is allowed as an alphabetic character<br />
• the underscore (_) is not allowed<br />
A DDNAME must obey the applicable rules of the external system.<br />
If DDNAME represents a data source on magnetic tape, the tape<br />
may be either labelled or nonlabelled (if the operating system<br />
supports it).<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 113
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DISPLAY<br />
Usage Notes<br />
Utility variables are replaced by their values before text is displayed. This is done by preceding<br />
the variable name with an ampersand (&). To display the name of a utility variable, code two<br />
“&”s instead of one.<br />
To display an apostrophe within the text string, two consecutive apostrophes (single quotes)<br />
must be used to distinguish it from both the single quotes enclosing the string and a regular<br />
double quote.<br />
In UNIX-based systems, if outfilename is used to redirect stdout as well as the file in a<br />
DISPLAY command, the results written to outfilename may be incomplete due to conflicting<br />
writes to the same file.<br />
On UNIX systems, use an asterisk (*) as the fileid specification to direct the display messages<br />
to the system console/standard output (stdout) device. The system console is the:<br />
• Display screen in interactive mode<br />
• Standard output device in batch mode<br />
114 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
DML<br />
Purpose<br />
The DML command defines a label and error treatment options for one or more immediately<br />
following DML statements. DML statements relevant to a <strong>Teradata</strong> T<strong>Pump</strong> job are INSERT,<br />
UPDATE, DELETE, and EXECUTE, with UPDATE and INSERT statements sometimes paired<br />
to form either a basic upsert or an Atomic upsert operation.<br />
Syntax<br />
.DML<br />
LABEL<br />
label<br />
A<br />
A ;<br />
MARK DUPLICATE<br />
ROWS<br />
IGNORE<br />
INSERT<br />
UPDATE<br />
MISSING<br />
UPDATE<br />
DELETE<br />
EXTRA<br />
UPDATE<br />
DELETE<br />
DO INSERT FOR<br />
MISSING UPDATE<br />
,<br />
SERIALIZEON ( serialize_on_field<br />
,<br />
)<br />
USE ( use_field )<br />
PARTITION<br />
ARRAYSUPPORT<br />
partition_name<br />
OFF<br />
ON<br />
3021E007<br />
where<br />
Syntax Element<br />
LABEL<br />
Description<br />
Keyword indicating that the following parameter is a label for the DML<br />
statements that follow<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 115
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
Syntax Element<br />
label<br />
MARK<br />
Description<br />
Unique label is to be used for the immediately following set of one or more<br />
DML statements<br />
A label must obey the same rules for its construction as <strong>Teradata</strong> SQL column<br />
names.<br />
The label name may be referenced in the APPLY clause of an IMPORT<br />
command.<br />
Keyword indicating that the system should make a duplicate, missing, or extra<br />
INSERT, UPDATE, or DELETE row entry in the error table and continue<br />
processing.<br />
A row is a duplicate row if all column values in the row are the exact duplicate<br />
of another row. Duplicate row checking is bypassed if the table is a multiset<br />
table (which allows duplicate rows), or if the table has one or more unique<br />
indexes (the uniqueness test(s) make any duplicate row check unnecessary).<br />
If MARK is set and a uniqueness violation occurs on either a unique primary<br />
index or a unique secondary index, the offending rows go to the error table,<br />
whether or not the row is a duplicate row. In the case of an upsert, both the<br />
INSERT and UPDATE portions must fail for an error to be recorded.<br />
If neither MARK or IGNORE is specified for duplicate rows, MARK applies to<br />
both INSERTs and UPDATEs. Similarly, if neither MARK or IGNORE is<br />
specified for missing or extra rows, MARK applies to both UPDATEs and<br />
DELETEs.<br />
MARK is the default for:<br />
• Both UPDATEs and DELETEs that refer to missing or extra rows.<br />
• Duplicate rows arising from both INSERTs and UPDATEs, except when<br />
those statements are combined to form an upsert, in which case the default<br />
is IGNORE.<br />
IGNORE<br />
keyword indicating that the system should not make an error table entry for<br />
the duplicate, missing, or extra INSERT, UPDATE, or DELETE row<br />
The system should continue processing instead.<br />
A row is a duplicate row if all column values in the row are the exact duplicate<br />
of another row. Duplicate row checking is bypassed if the table is a multiset<br />
table (which allows duplicate rows), or if the table has one or more unique<br />
indexes (the uniqueness test(s) make any duplicate row check unnecessary); in<br />
these cases, IGNORE DUPLICATE ROWS has no effect. Any uniqueness<br />
violations will result in the offending rows going to the error table.<br />
If neither INSERT nor UPDATE is specified for duplicate rows, IGNORE<br />
applies to both INSERTs and UPDATEs.<br />
Similarly, if neither UPDATE nor DELETE is specified for missing or extra<br />
rows, IGNORE applies to both UPDATEs and DELETEs. IGNORE is the<br />
default condition for an upsert operation.<br />
INSERT<br />
The upsert feature may be used (when used as DO INSERT FOR MISSING<br />
UPDATE ROWS or DO INSERT ROWS).<br />
116 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
Syntax Element<br />
Description<br />
An upsert saves time while loading a database. An upsert completes, in one<br />
pass, an operation which requires two passes for other utilities. The DML<br />
statements that follow this option must be in the order of a single UPDATE<br />
statement followed by a single INSERT statement.<br />
This option first executes the UPDATE statement. If the UPDATE fails because<br />
the target row does not exist, <strong>Teradata</strong> T<strong>Pump</strong> automatically executes the<br />
INSERT statement. This capability allows updates to the database without first<br />
presorting the data. Otherwise, the data would have to be sorted into:<br />
• rows that need to be updated<br />
• rows that need to be inserted<br />
Further information on the usage and restrictions of the upsert feature<br />
appears in the following usage notes.<br />
PARTITION<br />
partition_name<br />
SERIALIZEON<br />
serialize_on_field<br />
USE<br />
use_field<br />
Optional keyword used to name a session partition to be used for all SQL<br />
requests associated with this DML command<br />
If this keyword is not present, a session created from the SESSIONS will be<br />
used.<br />
Note: If serialization of two or more DML statements is required, the<br />
statements cannot be put in different partitions. Serialization requires that all<br />
DML statements with identical hash values of the rows be submitted from the<br />
same session.<br />
Parameter identifying the partition name<br />
The partition name must obey the same rules for its construction as <strong>Teradata</strong><br />
SQL column names.<br />
Keyword used to turn serialization on for the fields specified<br />
SERIALIZEON keyword may be used before, after, or between any IGNORE<br />
or MARK statements.<br />
Parameter identifying the field names where serialization is turned on<br />
This is the same field name used in the LAYOUT command which was used by<br />
the INSERT statement and referenced by the APPLY clause.<br />
Separate the field names with a comma and enclose them in parentheses.<br />
Keyword used to specify the fields that are to be used with a DML’s SQL<br />
statements<br />
Use of this keyword allows specification of the FIELDs from the LAYOUT<br />
command which are actually needed for each DML, so that data from all fields<br />
will not be sent.[<br />
The USE keyword may be placed before, after, or between any IGNORE/<br />
MARK statements.<br />
Parameter identifying the field names to use<br />
Every LAYOUT FIELD used by any of the DML’s SQL statements must be<br />
enumerated in the USE list; otherwise, an error will occur.<br />
Separate the field names with a comma and enclose them in parentheses.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 117
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
Syntax Element<br />
ArraySupport<br />
ON/OFF<br />
Description<br />
“ArraySupport ON|OFF” option to the .BEGIN LOAD command and the<br />
.DML command<br />
When “ArraySupport ON” is specified in the .BEGIN LOAD command, the<br />
.DML commands enclosed in .BEGIN LOAD and .END LOAD command pair<br />
will use the ArraySupport feature for its DML statement, unless “ArraySupport<br />
OFF” is specified for the .DML command. The default value of ArraySupport<br />
for the .BEGIN LOAD command is OFF.<br />
When “ArraySupport ON|OFF” is not specified with the .DML command, the<br />
default value for ArraySupport for that .DML command is the effective setting<br />
of ArraySupport in the .BEGIN LOAD command where the .DML command<br />
resides. When “ArraySupport ON|OFF” is specified at the .DML command,<br />
the specified value overrides the default setting determined by the .BEGIN<br />
LOAD command.<br />
When a .DML command is using the ArraySupport feature, it must contain<br />
one and only one DML statement and the session partition that the .DML<br />
command references needs to be used exclusively by this .DML command.<br />
If the DML statement is an UPSERT-type statement, it can be specified as a<br />
pair of INSERT/UPDATE statements with DO INSERT FOR MISSING<br />
UPDATE clause. <strong>Teradata</strong> T<strong>Pump</strong> will create its equivalent form of UPDATE<br />
… ELSE INSERT …, example Atomic Upsert, and use it as the actual DML<br />
statement. Or an UPDATE … ELSE INSERT … statement can be directly<br />
specified with DO INSERT FOR MISSING UPDATE clause.<br />
The non-atomic form of UPSERT is not supported by <strong>Teradata</strong> T<strong>Pump</strong> Array<br />
Support.<br />
Usage Notes<br />
The SQL EXECUTE command must be used between the BEGIN LOAD command and the<br />
END LOAD command.<br />
All INSERT, UPDATE, DELETE, and EXECUTE statements specified in the <strong>Teradata</strong> T<strong>Pump</strong><br />
script should fully specify the primary index of the referenced table to prevent the generation<br />
of table-level locks.<br />
A maximum of 2430 DML statements may be packed into a request; the default is<br />
20 statements.<br />
<strong>Teradata</strong> T<strong>Pump</strong> assumes that row hash locking is used by INSERT, UPDATE, DELETE, and<br />
EXECUTE statements. If row hash locking is not used, <strong>Teradata</strong> T<strong>Pump</strong> will run anyway, but<br />
may encounter trouble because table-level locking will cause each statement to block.<br />
In addition, <strong>Teradata</strong> T<strong>Pump</strong> does not support UPDATE or EXECUTE statements that<br />
modify the primary index of the target table. <strong>Teradata</strong> T<strong>Pump</strong> performs no checking to<br />
prevent the script author from creating DML that requests unreasonable updates, except that<br />
<strong>Teradata</strong> T<strong>Pump</strong> will not use Atomic UPSERT if the UPDATE portion of the UPSERT<br />
specifies an unreasonable update. This restriction is imposed by <strong>Teradata</strong> <strong>Data</strong>base.<br />
IGNORE DUPLICATE ROWS does not apply if there are ANY unique indexes in the row.<br />
118 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
Sample Scripts<br />
<strong>Teradata</strong> T<strong>Pump</strong> converts INSERT, UPDATE, and DELETE statements into macro<br />
equivalents, and, depending on the packing specified, submits multiple statements in one<br />
request. <strong>Teradata</strong> T<strong>Pump</strong> also supports the EXECUTE statement, which can be used to bypass<br />
the macro creation step for frequently executed macros. For more information on the<br />
EXECUTE statement, refer to EXECUTE in this chapter.<br />
The maximum number of INSERT, UPDATE, and DELETE statements that can be referenced<br />
in an IMPORT is 128. The 128th DML which would cause the insertion of the DML sequence<br />
number of 128 for the DMLSEQ field in the error table could lead to <strong>Teradata</strong> <strong>Data</strong>base 3520<br />
error.<br />
At the end of an IMPORT, an environmental variable is established for each DML command<br />
executed. <strong>Teradata</strong> T<strong>Pump</strong> variables are not limited to 30 characters. These variables contain<br />
the activity counts associated with each statement. The variables created are of the form:<br />
&IMP __<br />
where<br />
n = the number of the IMPORT, from one through four.<br />
Apply label = the label of the clause containing the DML command in question.<br />
x = the number of the statement within the containing APPLY clause.<br />
Serialization<br />
The SERIALIZEON keyword allows serialization to be turned on for the specified fields. The<br />
SERIALIZEON keyword can be used before, after, or between any IGNORE or MARK<br />
statements.<br />
The SERIALIZEON keyword can also be used with the SERIALIZE keyword in the BEGIN<br />
LOAD command and with the KEY keyword in the FIELD command. When it is used in this<br />
way, the DML-level serialization ignores and overrides the BEGIN LOAD-level serialization.<br />
In addition, the DML serialized APPLYs can be mixed with nonserialized DML APPLYs in the<br />
same IMPORT command.<br />
See “BEGIN LOAD” and “FIELD” for details about these commands.<br />
The following is an example using the SERIALIZEON keyword:<br />
.LOGTABLE TPLOG01;<br />
.LOGON slugger/dbc,dbc;<br />
.BEGIN LOAD<br />
ERRLIMIT 100 50<br />
CHECKPOINT 15<br />
SESSIONS 20<br />
TENACITY 2<br />
ERRORTABLE TPERR01<br />
PACK 30<br />
ROBUST ON<br />
NOMONITOR;<br />
.LAYOUT LAY01;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 119
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
.FIELD cc1 * CHAR(8);<br />
.FIELD cc2 * CHAR(4);<br />
.FIELD cc3 * CHAR(6);<br />
.FIELD cc4 * CHAR(62);<br />
.DML LABEL LABEL01<br />
DO INSERT FOR MISSING UPDATE ROWS<br />
SERIALIZEON (CC1);<br />
UPDATE TPTBL01<br />
SET C4 = :CC4<br />
WHERE C1 = :CC1;<br />
INSERT TPTBL01 (C1, C2, C4)<br />
VALUES (:CC1,:CC2, CC4);<br />
UPDATE TPTBL02 SET C4 = :CC4 WHERE C1 = :CC1<br />
AND C2 = :CC2;<br />
INSERT TPTBL02 (C1, C2, C3, C4)<br />
VALUES (:CC1,:CC2,:CC3, :CC4);<br />
.IMPORT INFILE .\TPDAT.txt FORMAT TEXT<br />
LAYOUT LAY01<br />
APPLY LABEL01<br />
APPLY LABEL02;<br />
.END LOAD;<br />
.LOGOFF;<br />
The following is an example using the USE keyword:<br />
.LOGTABLE TPLOG01;<br />
.LOGON slugger/cfl,cfl;<br />
DROP TABLE TPERR01;<br />
DROP TABLE TPTBL01;<br />
DROP TABLE TPTBL02;<br />
DROP TABLE TPTBL03;<br />
CREATE TABLE TPTBL01(<br />
C1 INTEGER,<br />
C2 VARCHAR(30),<br />
C3 VARCHAR(30),<br />
C4 VARCHAR(30),<br />
C5 VARCHAR(30),<br />
C6 VARCHAR(30))<br />
UNIQUE PRIMARY INDEX (C1);<br />
CREATE TABLE TPTBL02(<br />
C1 INTEGER,<br />
C2 VARCHAR(30),<br />
C3 VARCHAR(30),<br />
C4 VARCHAR(30),<br />
C5 VARCHAR(30))<br />
UNIQUE PRIMARY INDEX (C1);<br />
CREATE TABLE TPTBL03(<br />
C1 INTEGER,<br />
C2 VARCHAR(30),<br />
C3 VARCHAR(30),<br />
C4 VARCHAR(30),<br />
C5 VARCHAR(30),<br />
C6 VARCHAR(30),<br />
120 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
C7 VARCHAR(30),<br />
C8 VARCHAR(30),<br />
C10 VARCHAR(30),<br />
C11 VARCHAR(30))<br />
UNIQUE PRIMARY INDEX (C1);<br />
.BEGIN LOAD<br />
CHECKPOINT 15<br />
SESSIONS 5<br />
ERRORTABLE TPERR01<br />
NOMONITOR;<br />
.LAYOUT LAY01;<br />
.FIELD FLD1 * VARCHAR(10);<br />
.FIELD FLD2 * VARCHAR(10);<br />
.FIELD FLD3 * VARCHAR(10);<br />
.FIELD FLD4 * VARCHAR(15);<br />
.FIELD FLD5 * VARCHAR(20);<br />
.FIELD FLD6 * VARCHAR(25);<br />
.FIELD FLD7 * VARCHAR(30);<br />
.FIELD FLD8 * VARCHAR(30);<br />
.FIELD FLD9 * VARCHAR(1);<br />
.FIELD FLD10 * VARCHAR(30);<br />
.FIELD FLD11 * VARCHAR(30);<br />
.DML LABEL LABEL01 USE(FLD1, FLD2, FLD4, FLD6, FLD8, FLD10);<br />
INSERT TPTBL01 (C1, C2, C3, C4, C5, C6)<br />
VALUES (:FLD1,:FLD2,:FLD4,:FLD6,:FLD8,:FLD10);<br />
.DML LABEL LABEL02 USE(FLD1, FLD3, FLD5, FLD7, FLD11);<br />
INSERT TPTBL02 (C1, C2, C3, C4, C5)<br />
VALUES (:FLD1,:FLD3,:FLD5,:FLD7,:FLD11);<br />
.DML LABEL LABEL03;<br />
INSERT TPTBL03 (C1, C2, C3, C4, C5, C6, C7, C8, C10, C11)<br />
VALUES (:FLD1, :FLD2, :FLD3, :FLD4, :FLD5,<br />
:FLD6, :FLD7, :FLD8, :FLD10, :FLD11);<br />
.IMPORT INFILE INDATA FORMAT VARTEXT ','<br />
LAYOUT LAY01<br />
APPLY LABEL01 WHERE FLD9 = 'A'<br />
APPLY LABEL02 WHERE FLD9 = 'B'<br />
APPLY LABEL03;<br />
.VERSION;<br />
.END LOAD;<br />
.LOGOFF;<br />
Note that as in the above example, DML USE APPLYs can be mixed with DML APPLYs not<br />
using the USE keyword within the same IMPORT.<br />
The following is an example using partitioning:<br />
.LOGTABLE TPLOG01;<br />
.LOGON cs4400s3/cfl,cfl;<br />
DROP TABLE TPTBL01;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 121
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
DROP TABLE TPTBL02;<br />
DROP TABLE TPERR01;<br />
CREATE TABLE TPTBL01, FALLBACK(<br />
C1 CHAR(12) not null,<br />
C2 CHAR(8) not null)<br />
PRIMARY INDEX (C1);<br />
CREATE TABLE TPTBL02, FALLBACK(<br />
C1 CHAR(12),<br />
C2 CHAR(8),<br />
C3 CHAR(6))<br />
UNIQUE PRIMARY INDEX (C1);<br />
.BEGIN LOAD<br />
ERRLIMIT 100 50<br />
CHECKPOINT 15<br />
TENACITY 2<br />
ERRORTABLE TPERR01<br />
ROBUST off<br />
serialize on<br />
;<br />
.LAYOUT LAY02;<br />
.FIELD cc1 * CHAR(12) key;<br />
.FIELD cc2 * CHAR(8);<br />
.FIELD cc3 * CHAR(6);<br />
.filler space1 * char(1);<br />
.partition part1 pack 10 sessions 10;<br />
.partition part2 sessions 5 1 packmaximum;<br />
.DML LABEL LABEL01 partition part1<br />
DO INSERT FOR MISSING ROWS<br />
ignore extra update rows<br />
use(cc1, cc2);<br />
UPDATE TPTBL01<br />
SET C2 = :CC2<br />
WHERE C1 = :CC1;<br />
INSERT TPTBL01 (C1, C2)<br />
VALUES (:CC1,:CC2);<br />
.DML LABEL LABEL02 partition part2<br />
serializeon( cc1 )<br />
ignore extra update rows<br />
DO INSERT FOR MISSING UPDATE ROWS;<br />
UPDATE TPTBL02 SET C2 = :CC2 WHERE C1 = :CC1;<br />
INSERT TPTBL02 (C1, C2, C3)<br />
VALUES (:CC1,:CC2,:CC3);<br />
.IMPORT INFILE c:\NCR\Test\Tpump<strong>Data</strong>001.txt FORMAT TEXT<br />
LAYOUT LAY02<br />
APPLY LABEL01<br />
APPLY LABEL02 where CC2 = '00000001';<br />
.END LOAD;<br />
.LOGOFF;<br />
122 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
The Basic Upsert Feature<br />
Example Upsert<br />
When using the basic upsert feature:<br />
• There must be exactly two DML statements in this DML group.<br />
• The first DML statement must be an UPDATE statement that follows all of the <strong>Teradata</strong><br />
T<strong>Pump</strong> task rules.<br />
• The second DML statement must be an INSERT statement.<br />
• Both DML statements must refer to the same table.<br />
• The INSERT statement, when built, must reflect the same primary index specified in the<br />
WHERE clause of the UPDATE statement. This is true for both a single column primary<br />
index and a compound primary index.<br />
By following these rules, a number of uses for the DO INSERT ROWS option can be found. In<br />
the past, data could be presorted into INSERTs and UPDATEs, or UPDATEs attempted with<br />
all the data, and then do an INSERT on any UPDATEs that failed. With upsert, <strong>Teradata</strong><br />
T<strong>Pump</strong> needs only one pass of the data to UPDATE rows that need to be updated and INSERT<br />
rows that need to be inserted.<br />
Note: To ensure data integrity, the SERIALIZE parameter defaults to ON in the absence of an<br />
explicit value if there are upserts in the <strong>Teradata</strong> T<strong>Pump</strong> job.<br />
When MARK MISSING UPDATE ROWS specified, while using DO INSERT ROWS, <strong>Teradata</strong><br />
T<strong>Pump</strong> records any UPDATE that fails. This record appears in the Application Error Table,<br />
together with an error code that shows that the INSERT of the DO INSERT ROWS was then<br />
executed. If the INSERT fails, the INSERT row is also recorded in the Application Error table.<br />
The default for an upsert function, however, is not to mark missing update rows. This is<br />
because when the upsert function is performed, the INSERT is expected to occur when the<br />
UPDATE fails. The failure of the UPDATE portion of an upsert does not, in itself, constitute<br />
an error and should not be treated as one.<br />
The MARK MISSING DELETE ROW option has no meaning when used with the DO<br />
INSERT ROWS option.<br />
The option of MARK (IGNORE) EXTRA DELETE (UPDATE) ROWS provides <strong>Teradata</strong><br />
T<strong>Pump</strong> with a way to protect against an update or delete affecting multiple rows, which can<br />
happen in <strong>Teradata</strong> T<strong>Pump</strong> because the primary index can be non-unique.<br />
MARK is the default for all DML options, except for an upsert.<br />
Each record in the following example contains the value of the primary index column<br />
(EmpNo) of a row of the Employee table whose PhoneNo column is to be assigned a new<br />
phone number from field Fone.<br />
When the UPDATE fails, the INSERT statement is activated and <strong>Teradata</strong> T<strong>Pump</strong> enters the<br />
upsert mode. In this case, each record contains the primary index value (EmpNum) of a row<br />
that is to be inserted successively into the Employee table whose columns are EmpNo and<br />
PhoneNo.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 123
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
.BEGINLOAD SESSION number;<br />
.LAYOUT Layoutname;<br />
.FIELD EmpNum 1 INTEGER;<br />
.FIELD Fone * (CHAR (10));<br />
.DML LABEL DMLlabelname<br />
DO INSERT FOR MISSING UPDATE ROWS;<br />
UPDATE Employee SET PhoneNo = :Fone WHERE EmpNo = :EmpNum;<br />
INSERT Employee (EmpNo, PhoneNo) VALUES (:EmpNum, :Fone);<br />
.IMPORT INFILE Infilename LAYOUT Layoutname APPLY DMLlabelname;<br />
.END LOAD;<br />
The scope of a DML command (and its label) terminates at the first following command of<br />
any kind or at the end of the file containing the DML statements, whichever occurs first.<br />
The SQL EXECUTE command must be between the BEGIN LOAD command and END<br />
LOAD command.<br />
For IMPORT tasks, up to seven distinct error treatment options for one DML command may<br />
be specified. For example:<br />
.DML LABEL COMPLEX<br />
IGNORE DUPLICATE INSERT ROWS<br />
MARK DUPLICATE UPDATE ROWS<br />
IGNORE MISSING UPDATE ROWS<br />
MARK MISSING DELETE ROWS<br />
DO INSERT FOR MISSING UPDATE ROWS;<br />
It is valid to specify that missing update rows be both marked and treated as INSERTs or, as in<br />
the example, both ignored and treated as INSERTs.<br />
If <strong>Teradata</strong> T<strong>Pump</strong> encounters any of the following:<br />
• no DML command in an IMPORT task,<br />
• DML statements outside the scope of a DML command in an IMPORT task, or<br />
• a DML command with no DML statements in an IMPORT task,<br />
it writes a diagnostic message to the primary output destination for the system, terminates the<br />
<strong>Teradata</strong> T<strong>Pump</strong> task, and returns to the main <strong>Teradata</strong> T<strong>Pump</strong> control module with a<br />
conventional nonzero return code. The error can be corrected and resubmitted to the <strong>Teradata</strong><br />
T<strong>Pump</strong> task.<br />
The DML commands (with their following DML statements) must appear between the<br />
appropriate BEGIN LOAD command and the IMPORT commands that refer to them. When<br />
the END LOAD command is encountered, the sequence of DML commands and DML<br />
statements is forgotten. The DML command cannot be shared by multiple BEGIN LOAD<br />
statements. The DML statements are described in the following sections.<br />
The maximum number of DML commands that can be used in a single <strong>Teradata</strong> T<strong>Pump</strong> task<br />
is 128. If an excessive number of DML commands and statements are sent to <strong>Teradata</strong><br />
<strong>Data</strong>base, an error message is logged, stating that there are too many DML steps for one<br />
<strong>Teradata</strong> T<strong>Pump</strong> job.<br />
124 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
The Atomic Upsert Feature<br />
The basic upsert function has been enhanced to support an Atomic upsert capability. This<br />
enhancement permits <strong>Teradata</strong> T<strong>Pump</strong> to perform single-row upserts in a single pass. This<br />
one-pass logic adopts the upsert-handling technique used by MultiLoad. The one-pass logic is<br />
designated Atomic to distinguish the grouping of paired UPDATE and INSERT statements<br />
which are executed as a single SQL statement.<br />
The syntax for Atomic upsert consists of an UPDATE statement and an INSERT statement,<br />
separated by an ELSE keyword.<br />
Existing <strong>Teradata</strong> T<strong>Pump</strong> scripts using the Atomic upsert form do not have to be changed.<br />
<strong>Teradata</strong> T<strong>Pump</strong> will automatically convert the old UPDATE/INSERT pairs to the Atomic<br />
upsert feature whenever appropriate. Any attempts to change this will result in a syntax error.<br />
The new syntax, which can also be used by CLIv2 and BTEQ applications, is dependent on<br />
whether or not the database version, against which the <strong>Teradata</strong> T<strong>Pump</strong> job is run, supports<br />
this feature. If the database does not support Atomic Upsert, <strong>Teradata</strong> T<strong>Pump</strong> reverts to the<br />
earlier logic of sending the INSERT request if an UPDATE request fails.<br />
The three basic constraints on the upsert feature are:<br />
• SAME TABLE: The UPDATE and INSERT statements must specify the same table.<br />
• SAME ROW: The UPDATE and INSERT statements must specify the same row; that is, the<br />
primary index value in the INSERT row must be the same as the primary value in the<br />
targeted UPDATE row.<br />
• HASHED ROW ACCESS: The UPDATE fully specifies the primary index, allowing the<br />
target row to be accessed with a one-AMP hashed operation.<br />
Although <strong>Teradata</strong> T<strong>Pump</strong> does not verify basic upsert constraints, <strong>Teradata</strong> <strong>Data</strong>base will<br />
reject Atomic upsert constructs that fail the constraint test, and notify <strong>Teradata</strong> T<strong>Pump</strong> by<br />
returning an appropriate error message to the client.<br />
If the Atomic Upsert is done on a Temporal table, the optional Temporal qualifier can only be<br />
added before the UPDATE statement.<br />
Other Restrictions on Atomic Upsert Feature<br />
Some of these restrictions concern syntax that is supported in UPDATE and INSERT<br />
statements separately, but not when combined in an Atomic upsert statement. Other<br />
restrictions concern the upsert feature's not supporting certain <strong>Teradata</strong> <strong>Data</strong>base features<br />
such as triggers and join/hash indexes, meaning that the upsert statement cannot be used on<br />
any table utilizing those features.<br />
The following restrictions are not supported by the Atomic upsert feature, and return an error<br />
if submitted to <strong>Teradata</strong> <strong>Data</strong>base:<br />
• INSERT … SELECT: Syntax not supported. The INSERT may not use a subquery to<br />
specify any of the inserted values. Note that support of this syntax is likely to be linked to<br />
support of subqueries in the UPDATE's WHERE clause constraints as described above,<br />
and may involve new syntax features to allow the UPDATE and INSERT to effectively<br />
reference the same subquery.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 125
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
• UPDATE-WHERE-CURRENT: Syntax not supported. The WHERE clause cannot use an<br />
updatable cursor to do what is called a positioned UPDATE. (It is unlikely that this syntax<br />
will ever be supported.) Note that this restriction does not prevent cursors from being<br />
used in other ways with Atomic upsert statements. For example, a DECLARE CURSOR<br />
statement may include upsert statements among those to be executed when the cursor is<br />
opened, as long as the upserts are otherwise valid.<br />
• UPDATE-FROM: Not supported. The SET clause cannot use a FROM clause table<br />
reference in the expression for the updated value for a column.<br />
• UPDATE-WHERE SUBQUERIES: Not supported. The WHERE clause cannot use a<br />
subquery either to specify the primary index or to constrain a nonindex column. Note that<br />
supporting this UPDATE syntax would also require support for either INSERT … SELECT<br />
or some other INSERT syntax feature that lets it specify the same primary index value as<br />
the UPDATE.<br />
• UPDATE-PRIMARY INDEX: Not supported. The UPDATE cannot change the primary<br />
index. This is sometimes called unreasonable update.<br />
• TRIGGERS: Feature not supported if either the UPDATE or INSERT could cause a trigger<br />
to be fired. The restriction applies as if the UPDATE and INSERT were both executed,<br />
because the parser trigger logic will not attempt to account for their conditional execution.<br />
UPDATE triggers on columns not referenced by the UPDATE clause, however, will never<br />
be fired by the upsert and are therefore permitted. DELETE triggers cannot be fired at all<br />
by an upsert and are likewise permitted. Note that an upsert could be used as a trigger<br />
action but it would be subject to the same constraints as any other upsert. Because an<br />
upsert is not allowed to fire any triggers itself, an upsert trigger action must not generate<br />
any further cascaded trigger actions.<br />
• JOIN/HASH INDEXES: Feature not supported if either the UPDATE or INSERT could<br />
cause the join/hash index to be updated. As with triggers, the restriction applies to each<br />
upsert as if the UPDATE and INSERT were both executed. While the UPDATE could<br />
escape this restriction if the join/hash index does not reference any of the updated<br />
columns, it is much less likely (and maybe impossible) for the INSERT to escape. If the<br />
benefit of lifting the restriction for a few unlikely join/hash index cases turns out to be not<br />
worth the implementation cost, the restriction may have to be applied more broadly to any<br />
table with an associated join/hash index.<br />
Treat the failed constraint as a nonfatal error, report the error in the job log for diagnostic<br />
purposes, and continue with the job by reverting to the old non-Atomic upsert protocol.<br />
Existing <strong>Teradata</strong> T<strong>Pump</strong> Scripts<br />
Existing <strong>Teradata</strong> T<strong>Pump</strong> scripts for upserts do not need to be changed. The syntax as<br />
described below for an upsert will continue to be supported:<br />
DO INSERT FOR MISSING UPDATE ROWS;<br />
UPDATE ;<br />
INSERT ;<br />
126 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
Atomic Upsert Examples<br />
This section describes several examples that demonstrate how the Atomic upsert feature<br />
works, including cases where errors are detected and returned to the user. All of the examples<br />
use the same table, called Sales, as shown below:<br />
CREATE TABLE Sales, FALLBACK,<br />
(ItemNbr INTEGER NOT NULL,<br />
SaleDate DATE FORMAT 'MM/DD/YYYY' NOT NULL,<br />
ItemCount INTEGER)<br />
PRIMARY INDEX (ItemNbr);<br />
It is assumed that the table has been populated with the following data:<br />
INSERT INTO Sales (10, '05/30/2005', 1);<br />
Assume that there exists a table called NewSales that has the same column definitions as those<br />
of table Sales.<br />
Example 1 (Error: Different Target Tables)<br />
This example demonstrates an upsert statement that does not specify the same table name for<br />
the UPDATE part and the INSERT part of the statement.<br />
.Dml label upsertdml do insert for missing update rows;<br />
UPDATE Sales SET ItemCount = ItemCount + 1 WHERE (ItemNbr = 10 AND<br />
SaleDate = '05/30/2005');<br />
INSERT INTO NewSales (10,'05/30/2005', 1);<br />
A rule of an upsert statement is that only one single table is processed for the statement.<br />
Because the tables, Sales and NewSales, are not the same for the upsert statement, an error is<br />
returned, indicating that the name of the table must be the same for both the UPDATE and<br />
the INSERT.<br />
Example 2 (Error: Different Target Rows)<br />
This example demonstrates an upsert statement that does not specify the same primary index<br />
value for the UPDATE part and the INSERT part of the statement.<br />
.Dml label upsertdml do insert for duplicate update rows;<br />
UPDATE Sales SET ItemCount = ItemCount + 1 WHERE (ItemNbr = 10 AND<br />
SaleDate = '05/30/2005');<br />
INSERT INTO Sales (20,'05/30/2005', 1);<br />
The primary index values for the UPDATE and the INSERT must be the same. Otherwise, we<br />
would be looking at two different rows: one for UPDATE and the other for INSERT, which is<br />
not the purpose of an upsert. An error is returned for the upsert statement because the<br />
specified primary index values of 10 and 20 are not the same (the primary index value must be<br />
the same for both the UPDATE and the INSERT).<br />
Example 3 (Valid Upsert UPDATE)<br />
This example demonstrates a successful upsert statement where a row gets updated.<br />
.Dml label upsertdml do insert for missing update rows;<br />
UPDATE Sales SET ItemCount = ItemCount + 1 WHERE (ItemNbr = 10 AND<br />
SaleDate = '05/30/2005');<br />
INSERT INTO Sales (10, '05/30/2005', 1);<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 127
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
DML<br />
After all of the rules have been validated, the row with ItemNbr = 10 and SaleDate = '05/30/<br />
2005' gets updated. A successful update of one row is returned.<br />
Example 4 (Valid Upsert INSERT)<br />
This example demonstrates a successful upsert statement where a row gets inserted.<br />
.Dml label upsertdml do insert for missing update rows;<br />
UPDATE Sales SET ItemCount = ItemCount + 1 WHERE (ItemNbr = 20 AND<br />
SaleDate = '05/30/2005')<br />
INSERT INTO Sales (20, '05/30/2005', 1);<br />
After all of the rules have been validated and no row was found with Item = 20 and SaleDate =<br />
'05/30/2005' for the UPDATE, a new row is inserted with ItemNbr = 20. A successful insert of<br />
one row is returned.<br />
128 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
END LOAD<br />
END LOAD<br />
Purpose<br />
The END LOAD command must be present as the last command of a <strong>Teradata</strong> T<strong>Pump</strong> task to<br />
initiate the execution of the task.<br />
Syntax<br />
.END LOAD<br />
;<br />
3021A022<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 129
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
EXECUTE<br />
EXECUTE<br />
Purpose<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports the <strong>Teradata</strong> SQL EXECUTE statement, which specifies a usercreated<br />
(predefined) macro for execution. The EXECUTE statement specifies the type of DML<br />
statement (INSERT, UPDATE, DELETE, or UPSERT) to be handled by the macro.<br />
The macro named in this EXECUTE statement must reside in <strong>Teradata</strong> <strong>Data</strong>base before the<br />
import task starts. Only one DML statement (INSERT, UPDATE, DELETE, or UPSERT) can<br />
be specified in a <strong>Teradata</strong> T<strong>Pump</strong> predefined macro.<br />
Caution:<br />
The SQL EXECUTE command must be used between the BEGIN LOAD command and the<br />
END LOAD command.<br />
Syntax<br />
EXECUTE name UPDATE/UPD<br />
;<br />
EXEC database.<br />
INSERT/INS<br />
DELETE/DEL<br />
UPSERT/UPS<br />
3021A001<br />
where<br />
Syntax Element<br />
database<br />
name<br />
DELETE/DEL<br />
INSERT/INS<br />
UPDATE/UPD<br />
UPSERT/UPS<br />
Description<br />
Name of the database in <strong>Teradata</strong> <strong>Data</strong>base where the macro to be executed<br />
resides<br />
Name of the macro resident in <strong>Teradata</strong> <strong>Data</strong>base to be executed<br />
Keyword indicating a DELETE statement is being executed by the macro<br />
Keyword indicating an INSERT statement is being executed by the macro<br />
Keyword indicating an UPDATE statement is being executed by the macro<br />
Keyword indicating an Atomic upsert is being executed by the macro<br />
Usage Notes<br />
Using predefined macros saves time because <strong>Teradata</strong> T<strong>Pump</strong> does not need to create and<br />
drop new macros each time a <strong>Teradata</strong> T<strong>Pump</strong> job script is run.<br />
The rules for user-created macros are:<br />
130 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
EXECUTE<br />
• <strong>Teradata</strong> T<strong>Pump</strong> expects the parameter list for any macro to match the FIELD list specified<br />
by the LAYOUT in the script. FILLER fields are ignored. If the USE clause is used in the<br />
DML statement, <strong>Teradata</strong> T<strong>Pump</strong> expects the parameter list for every macro in the DML<br />
statement to match the field list specified by the USE clause. The order should be the same<br />
as the fields in the LAYOUT.<br />
• The macro should specify a single prime index operation: INSERT, UPDATE, DELETE, or<br />
UPSERT. <strong>Teradata</strong> T<strong>Pump</strong> reports an error if the macro contains more than one<br />
supported statement.<br />
• The restrictions on INSERT, UPDATE, DELETE, and UPSERT statements supported by<br />
<strong>Teradata</strong> T<strong>Pump</strong> are described in the corresponding sections of this manual.<br />
If the EXECUTE statement is replacing an INSERT, UPDATE, DELETE, or UPSERT statement<br />
in a job script, the EXECUTE statement must be placed at the same location as the INSERT,<br />
UPDATE, DELETE, or UPSERT statement that it replaces. The following example shows an<br />
INSERT statement is replaced by an equivalent predefined macro:<br />
.DML LABEL LABELA;<br />
DELETE ;<br />
INSERT ;<br />
UPDATE ;<br />
.DML LABEL LABELA ;<br />
DELETE ;<br />
EXECUTE INSERT ;<br />
UPDATE ;<br />
The correct syntax for a <strong>Teradata</strong> T<strong>Pump</strong> predefined macro is one of the following:<br />
• CREATE MACRO () as (UPDATE....; ) ;<br />
• CREATE MACRO () as (INSERT.....; ) ;<br />
• CREATE MACRO () as (DELETE.....; ) ;<br />
• CREATE MACRO () as (UPSERT.....; ) ;<br />
If a <strong>Teradata</strong> <strong>Data</strong>base server supports Atomic upsert, then automatic use of Atomic upsert is<br />
allowed, when possible, without changing existing <strong>Teradata</strong> T<strong>Pump</strong> scripts. This is<br />
accomplished in the following manner:<br />
• <strong>Teradata</strong> T<strong>Pump</strong> attempts to use the Atomic upsert syntax in defining a single UPSERT<br />
macro (instead of an UPDATE/INSERT macro pair).<br />
• If the UPSERT macro is successfully defined, <strong>Teradata</strong> T<strong>Pump</strong> uses the Atomic upsert<br />
function for the UPSERT.<br />
• If an error occurs during UPSERT macro definition, presumably due to a violation of<br />
<strong>Teradata</strong> <strong>Data</strong>base Atomic upsert restrictions, <strong>Teradata</strong> T<strong>Pump</strong> issues a warning and<br />
reverts to the current <strong>Teradata</strong> T<strong>Pump</strong> upsert method of paired UPDATE/INSERT<br />
statements.<br />
<strong>Teradata</strong> T<strong>Pump</strong> will continue to operate as it does now when the existing <strong>Teradata</strong> T<strong>Pump</strong><br />
syntax for upsert is encountered, and references to predefined macros are used for either the<br />
UPDATE or the INSERT or both.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 131
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
EXECUTE<br />
For example:<br />
.DML LABEL DO INSERT FOR MISSING UPDATE ROWS ... ;<br />
EXECUTE UPDATE ;<br />
INSERT ;<br />
.DML LABEL DO INSERT FOR MISSING UPDATE ROWS ... ;<br />
UPDATE ;<br />
EXECUTE INSERT ;<br />
.DML LABEL DO INSERT FOR MISSING UPDATE ROWS ... ;<br />
EXECUTE UPDATE ;<br />
EXECUTE INSERT ;<br />
To allow for the use of predefined macros that take advantage of Atomic upsert, <strong>Teradata</strong><br />
T<strong>Pump</strong> command syntax supports an UPSERT macro:<br />
.DML LABEL ;<br />
EXECUTE UPSERT ;<br />
When using predefined macros for atomic upserts, the DML statement will have “Ignore<br />
Missing Update Rows” as a default option.<br />
Atomic upsert syntax is not backward compatible; thus it cannot be used until the <strong>Teradata</strong><br />
<strong>Data</strong>base server is updated to a compatible release. If <strong>Teradata</strong> <strong>Data</strong>base supports Atomic<br />
upsert, a <strong>Teradata</strong> T<strong>Pump</strong> run can handle a mix of both standard and Atomic upserts.<br />
Upserts are reported as UPDATEs and INSERTs in the statistics displayed by <strong>Teradata</strong> T<strong>Pump</strong><br />
(and passed to the NOTIFY EXIT routine), because an Atomic upsert that results in an<br />
UPDATE will be reported by <strong>Teradata</strong> <strong>Data</strong>base as an UPDATE activity type, and an Atomic<br />
upsert that results in an INSERT will be reported by <strong>Teradata</strong> <strong>Data</strong>base as an INSERT activity<br />
type.<br />
132 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
FIELD<br />
FIELD<br />
Purpose<br />
The FIELD command specifies a field of the input record; it can also contain a NULLIF<br />
expression. All fields specified by FIELD commands are sent to <strong>Teradata</strong> <strong>Data</strong>base. Only<br />
fields relevant to the tasks using this layout need be specified.<br />
Syntax<br />
.FIELD fieldname startpos datadesc<br />
A<br />
fieldexpr<br />
NULLIF nullexpr<br />
A<br />
DROP<br />
LEADING<br />
TRAILING<br />
BLANKS<br />
NULLS<br />
AND<br />
TRAILING<br />
LEADING<br />
NULLS<br />
BLANKS<br />
B ;<br />
KEY<br />
B<br />
3021A019<br />
where<br />
Syntax Element<br />
fieldname<br />
Description<br />
Name of an input record field to which:<br />
1 a DML statement refers,<br />
2 a nullexpr of a FIELD command or condition expression of a LAYOUT<br />
command refers, or<br />
3 a condition expression of the IMPORT command APPLY clause refers.<br />
A fieldname must obey the same rules for its construction as <strong>Teradata</strong> SQL<br />
column names.<br />
fieldname can be referenced in other FIELD commands via NULLIF and field<br />
concatenation expressions, and in APPLY WHERE conditions in IMPORT<br />
commands.<br />
startpos<br />
Starting position of a field of the data records in an external data source<br />
It may be specified as an unsigned integer which is a character position starting<br />
with 1, or as an asterisk which means the next available character position<br />
beyond the preceding field. Nothing prevents redefinition of positions of input<br />
records by specifying the same positions in multiple FIELD commands. See the<br />
example below.<br />
Note that where input records may be continued by use of the CONTINUEIF<br />
condition, a startpos specified as an unsigned integer refers to a character<br />
position in the final concatenated result from which the continuation indicator<br />
fields have been removed. Refer to the description of the condition parameter of<br />
the LAYOUT command.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 133
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
FIELD<br />
Syntax Element<br />
datadesc<br />
nullexpr<br />
nullexpr<br />
Continued<br />
Description<br />
Type and length of data in the field.<br />
<strong>Teradata</strong> T<strong>Pump</strong> generates the USING phrase accordingly with the<br />
user-assigned field name to which the body of the DML statement refers.<br />
Condition used for selectively inserting a null value into the affected column<br />
The condition is specified as a conditional expression involving any number of<br />
fields, each represented by its fieldname, and constants. All fieldnames appearing<br />
in the conditional expression must be defined by any of the following<br />
specifications:<br />
1 The startpos and datadesc parameters of the FIELD command.<br />
2 A FILLER command.<br />
3 A TABLE command.<br />
If the specified condition is true, <strong>Teradata</strong> T<strong>Pump</strong> sends the data to <strong>Teradata</strong><br />
<strong>Data</strong>base with indicators, whether or not the INDICATORS option is specified<br />
on the LAYOUT command.<br />
When the character set of the job script is different from the client character set<br />
used for the job (for example, on z/OS the job script must be in <strong>Teradata</strong><br />
EBCDIC when using the UTF-8 client character set, or UTF-16 client character<br />
set can be used with the job script in UTF-8), <strong>Teradata</strong> T<strong>Pump</strong> will translate the<br />
string constants specified in the expression and the import data referenced in<br />
the expression to the same character set before evaluating the expression.<br />
For example, when the client character set is UTF-16 and the script character<br />
set is UTF-8, if the following commands are given:<br />
.field C1 * varchar(20);<br />
.field C2 * varchar(40) nullif c1 = 'DELETED';<br />
<strong>Teradata</strong> T<strong>Pump</strong> will translate the data in the C1 field to the UTF-8 form and<br />
compare it with the UTF-8 form of 'DELETED' to obtain the evaluation result.<br />
Similarly, on the mainframe, when the client character set is UTF8 and the script<br />
character set is <strong>Teradata</strong> EBCDIC, if the following commands are given:<br />
.field C1 * char(20);<br />
.field C2 * rchar(40) nullif c1 = 'removed';<br />
<strong>Teradata</strong> T<strong>Pump</strong> will translate the data in the C1 field from the UTF8 form to<br />
the <strong>Teradata</strong> EBCDIC form and compare it to the <strong>Teradata</strong> EBCDIC form of<br />
'removed' to obtain the valuation result.<br />
Caution: When using UTF8 client set on the mainframe, be sure to examine<br />
the definition in International Character Set Support to determine the<br />
code points of the special characters which might be required.<br />
Different versions of EBCDIC do not always agree as to the<br />
placement of these characters.<br />
The mappings between <strong>Teradata</strong> EBCDIC and Unicode can be<br />
referred to in Appendix E of International Character Set Support.<br />
The fieldname1 parameter in other FIELD commands can be referenced in<br />
nullexpr.<br />
134 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
FIELD<br />
Syntax Element<br />
fieldexpr<br />
DROP<br />
KEY<br />
Description<br />
Concatenation of two or more items, either:<br />
• fields<br />
• character constants<br />
• string constants<br />
or a combination of these, as in:<br />
fieldname1||'C'||fieldname2||'STRING'||fieldname3...<br />
The field names within a layout must be unique and the data type of the field<br />
must be either CHAR or VARCHAR. Nested concatenations are not supported.<br />
If all items of the fieldexpr are fixed character (for example, no VARCHARs), the<br />
data type of the resulting field is CHAR(m), where “m” is the sum of the length<br />
for each component item.<br />
If at least one component of the fieldexpr is a VARCHAR, the data type of the<br />
resulting field is VARCHAR(m), where “m” is the sum of the maximum length<br />
for each component item.<br />
When the character set of the job script is different from the client character set<br />
used for the job (for example, on z/OS the job script must be in <strong>Teradata</strong><br />
EBCDIC when using the UTF8 client character set, or UTF-16 client character<br />
set can be used with the job script in UTF8), <strong>Teradata</strong> T<strong>Pump</strong> will translate the<br />
character constants and the string constants specified in the expression from the<br />
script character set form to the client character set form before concatenating<br />
the constants with the specified fields.<br />
Caution: When using the UTF8 client set on the mainframe, be sure to<br />
examine the definition in International Character Set Support to<br />
determine the code points of the special characters which might be<br />
require. Different versions of EBCDIC do not always agree as to the<br />
placement of these characters.<br />
The mappings between <strong>Teradata</strong> EBCDIC and Unicode can be<br />
referred to in Appendix E of International Character Set Support.<br />
Characters present in the specified position(s) to be dropped from the specified<br />
fieldname, which must be of a character data type<br />
<strong>Teradata</strong> T<strong>Pump</strong> drops the specified characters and presents the field to<br />
<strong>Teradata</strong> <strong>Data</strong>base as a VARCHAR data type.<br />
If two dropping actions are specified, they must not be identical.<br />
If a FIELD command defines a fieldname in terms of two or more concatenated<br />
fieldname fields, any specified DROP clause applies to the concatenated result,<br />
not to the individual fieldname fields. But, because each fieldname must be<br />
defined by its own previous FIELD command, a DROP clause can be specified<br />
on these commands to apply to the individual fields.<br />
Keyword, which, when added to the end of the FIELD command, specifies that<br />
the field is part of the hash key for purposes of serialization, if the SERIALIZE<br />
parameter on the BEGIN LOAD command is active.<br />
The serialization feature is meaningful only when a primary key for the loaded<br />
data is specified via this KEY option.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 135
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
FIELD<br />
Usage Notes<br />
One or more FIELD commands may be intermixed with the TABLE command and the<br />
FILLER command. These commands must follow a LAYOUT command.<br />
If an input record field in fieldname is redefined, the data type from “character” to “decimal”<br />
with the datadesc parameter cannot be changed. This is illegal in <strong>Teradata</strong> T<strong>Pump</strong> and will<br />
abort the job and return an error message.<br />
If both NULLIF and DROP LEADING/TRAILING BLANKS/NULLSis specified on the same<br />
FIELD command, the DROP clause is evaluated after the NULLIF clause. As an example, in<br />
the FIELD command:<br />
.FIELD FIELDNAME * CHAR (5) NULLIF FIELDNAME = 'x'<br />
DROP LEADING BLANKS;<br />
if the input for fieldname is 'x', the NULLIF expression would evaluate to false because the<br />
leading blanks are not dropped before the NULLIF evaluation.<br />
Specifying <strong>Data</strong> Types<br />
Use the datadesc parameter to specify the type and length of data in the field. <strong>Teradata</strong> T<strong>Pump</strong><br />
generates the USING phrase accordingly with the user-assigned field name to which the body<br />
of the DML statement refers.<br />
For complete details on data types and data conversions, see SQL <strong>Data</strong> Types and Literals.<br />
The following is a short list of the input length and field description for the data type<br />
specifications which can be made in the datadesc parameter:<br />
Graphic <strong>Data</strong> Type Specifications<br />
GRAPHIC(n)<br />
Where n is the length of the input stream in terms of double-byte characters.<br />
Length: n*2 bytes, if n is specified; otherwise 2 bytes, as n=1 is assumed.<br />
Description: n double-byte characters.<br />
The following example illustrates the use of the GRAPHIC data types in support of kanji or<br />
multibyte character data. The FIELD statement can contain GRAPHIC data types.<br />
.LAYOUT KANJIDATA;<br />
.FIELD EMPNO * SMALLINT;<br />
.FIELD LASTNAME * GRAPHIC(30);<br />
.FILLER FIRSTNAME * GRAPHIC(30);<br />
.FIELD JOBTITLE * VARGRAPHIC(30);<br />
VARGRAPHIC(n)<br />
Where n is the length of the input stream in terms of double-byte characters.<br />
Length: m + 2 bytes where m/2
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
FIELD<br />
Length: m + 2 bytes where m/2
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
FIELD<br />
Example 1<br />
Instead of specifying the following:<br />
...<br />
.FIELD fc * CHAR(5) NULLIF fc = 'empty';<br />
.FIELD fi * INTEGER NULLIF fi = 0;<br />
...<br />
.DML LABEL ins;<br />
INSERT INTO tbl1 VALUES(...,:fc,:fi,...);<br />
Use this instead:<br />
...<br />
.FIELD fc * CHAR(5);<br />
.FIELD fi * INTEGER;<br />
...<br />
.DML LABEL ins;<br />
INSERT INTO tbl1 VALUES(...,NULLIF(:fc,'empty'),NULLIF(:fi,0),...);<br />
Example 2<br />
In more complex situations, as in the following example:<br />
...<br />
.FIELD fs * CHAR(1) ;<br />
.FIELD fc * CHAR(5) NULLIF (fs 'M') AND (fs 'F');<br />
.FIELD fi * INTEGER NULLIF fi < 0;<br />
...<br />
.DML LABEL ins;<br />
INSERT INTO tbl2 VALUES(...,:fs,:fc,:fi,...);<br />
Use this instead:<br />
...<br />
.FIELD fs * CHAR(1) ;<br />
.FIELD fc * CHAR(5);<br />
.FIELD fi * INTEGER;<br />
...<br />
.DML LABEL ins;<br />
INSERT INTO tbl2 VALUES(...,:fs,<br />
CASE WHEN (:fs = 'M') OR (:fs = 'F') THEN :fc ELSE NULL END,<br />
CASE WHEN (:fi >= 0) THEN :fi ELSE NULL END,...);<br />
Using ANSI/SQL DateTime <strong>Data</strong> Types<br />
When the DATEFORM command is used to specify ANSIDATE as the DATE data type, each<br />
DATE field is internally converted to a CHAR(10) field. All ANSI/SQL DateTime TIME,<br />
TIMESTAMP, and INTERVAL data types must be converted to fixed-length CHAR data types<br />
to specify column and field names in a <strong>Teradata</strong> T<strong>Pump</strong> FIELD command.<br />
Table 28 shows how to use ANSI/SQL DateTime specifications.<br />
138 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
FIELD<br />
Table 28: ANSI/SQL DateTime Specifications<br />
<strong>Data</strong> Type Variable Definition Conversion Example<br />
TIME<br />
TIME (n)<br />
TIMESTAMP<br />
TIMESTAMP (n)<br />
TIME WITH TIME ZONE<br />
TIME (n) WITH TIME<br />
ZONE<br />
TIMESTAMP WITH TIME<br />
ZONE<br />
TIMESTAMP (n) WITH<br />
TIME ZONE<br />
INTERVAL YEAR<br />
INTERVAL YEAR (n)<br />
INTERVAL YEAR TO<br />
MONTH<br />
INTERVAL YEAR (n) TO<br />
MONTH<br />
n = number of digits<br />
after decimal point<br />
Valid values: 0–6<br />
Default = 6<br />
n = number of digits<br />
after decimal point<br />
Valid values: 0–6<br />
Default = 6<br />
n = number of digits<br />
after decimal point<br />
Valid values: 0–6<br />
Default = 6<br />
n = number of digits<br />
after decimal point<br />
Valid values: 0-6<br />
Default = 6<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
CHAR(8 + n + (1 if n > 0, otherwise 0))<br />
Format (n = 0): hh:mm:ss<br />
Example: 11:37:58<br />
Format: (n = 4): hh:mm:ss.ssss<br />
Example: 11:37:58.1234<br />
CHAR(19 + n + (1 if n > 0, otherwise 0))<br />
Format (n = 0): yyyy-mm-dd hh:mm:ss<br />
Example: 1998-09-04 11:37:58<br />
Format (n = 4):<br />
yyyy-mm-dd hh:mm:ss.ssss<br />
Example:<br />
1998-09-04 11:37:58.1234<br />
CHAR(14 + n + (1 if n > 0, otherwise 0))<br />
Format (n = 0): hh:mm:ss{±}hh:mm<br />
Example: 11:37:58-08:00<br />
Format (n = 4): hh:mm:ss.ssss {±} hh:mm<br />
Example: 11:37:58.1234-08:00<br />
CHAR(25 + n + (1 if n > 0, otherwise 0))<br />
Format (n = 0):<br />
yyyy-mm-dd hh:mm:ss{±}hh:mm<br />
Example:<br />
1998-09-24 11:37:58+07:00<br />
Format (n = 4):<br />
yyyy-mm-dd hh:mm:ss.ssss{±} hh:mm<br />
Example:<br />
1998-09-24 11:37:58.1234+07:00<br />
CHAR(n)<br />
Format (n = 2): yy<br />
Example: 98<br />
Format: (n = 4): yyyy<br />
Example: 1998<br />
CHAR(n + 3)<br />
Format (n = 2): yy-mm<br />
Example: 98-12<br />
Format: (n = 4): yyyy-mm<br />
Example: 1998-12<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 139
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
FIELD<br />
Table 28: ANSI/SQL DateTime Specifications (continued)<br />
<strong>Data</strong> Type Variable Definition Conversion Example<br />
INTERVAL MONTH<br />
INTERVAL MONTH (n)<br />
INTERVAL DAY<br />
INTERVAL DAY (n)<br />
INTERVAL DAY TO HOUR<br />
INTERVAL DAY (n) TO<br />
HOUR<br />
INTERVAL DAY TO<br />
MINUTE<br />
INTERVAL DAY (n) TO<br />
MINUTE<br />
INTERVAL DAY TO<br />
SECOND<br />
INTERVAL DAY (n) TO<br />
SECOND<br />
INTERVAL DAY TO<br />
SECOND (m)<br />
INTERVAL DAY (n) TO<br />
SECOND (m)<br />
INTERVAL HOUR<br />
INTERVAL HOUR (n)<br />
INTERVAL HOUR TO<br />
MINUTE<br />
INTERVAL HOUR (n) TO<br />
MINUTE<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
m = number of digits<br />
after decimal point<br />
Valid values: 0-6<br />
Default = 6<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
CHAR(n)<br />
Format (n = 2): mm<br />
Example: 12<br />
Format: (n = 4): mmmm<br />
Example: 0012<br />
CHAR(n)<br />
Format (n = 2): dd<br />
Example: 31<br />
Format: (n = 4): dddd<br />
Example: 0031<br />
CHAR(n + 3)<br />
Format (n = 2): dd hh<br />
Example: 31 12<br />
Format: (n = 4): dddd hh<br />
Example: 0031 12<br />
CHAR(n + 6)<br />
Format (n = 2): dd hh:mm<br />
Example: 31 12:59<br />
Format: (n = 4): dddd hh:mm<br />
Example: 0031 12:59<br />
CHAR(n + 9 + m + (1 if m > 0, otherwise<br />
0))<br />
Format (n = 2, m = 0): hh:mm:ss<br />
Example: 12:59:59<br />
Format: (n = 4, m = 4): hhhh:mm:ss.ssss<br />
Example: 0012:59:59.1234<br />
CHAR(n)<br />
Format: (n = 2): hh<br />
Example: 12<br />
Format: (n = 4): hhhh<br />
Example: 0012<br />
CHAR(n + 3)<br />
Format: (n = 2): hh:mm<br />
Example: 12:59<br />
Format: (n = 4): hhhh:mm<br />
Example: 0012:59<br />
140 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
FIELD<br />
Table 28: ANSI/SQL DateTime Specifications (continued)<br />
<strong>Data</strong> Type Variable Definition Conversion Example<br />
INTERVAL HOUR TO<br />
SECOND<br />
INTERVAL HOUR (n TO<br />
SECOND<br />
INTERVAL HOUR TO<br />
SECOND (m)<br />
INTERVAL HOUR (n) TO<br />
SECOND (m)<br />
INTERVAL MINUTE<br />
INTERVAL MINUTE (n)<br />
INTERVAL MINUTE TO<br />
SECOND<br />
INTERVAL MINUTE (n)<br />
TO SECOND<br />
INTERVAL MINUTE TO<br />
SECOND (m)<br />
INTERVAL MINUTE (n)<br />
TO SECOND (m)<br />
INTERVAL SECOND<br />
INTERVAL SECOND (n)<br />
INTERVAL SECOND (n,m)<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
m = number of digits<br />
after the decimal point<br />
Valid values: 0-6<br />
Default = 6<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
m = number of digits<br />
after decimal point<br />
Valid values: 0-6<br />
Default = 6<br />
n = number of digits<br />
Valid values: 1-4<br />
Default = 2<br />
m = number of digits<br />
after decimal point<br />
Valid values: 0-6<br />
Default = 6<br />
CHAR(n + 6 + m + (1 if m > 0, otherwise<br />
0))<br />
Format: (n = 2, m = 0): hh:mm:ss<br />
Example: 12:59:59<br />
Format: (n = 4, m = 4): hhhh:mm:ss.ssss<br />
Example: 0012:59:59.1234<br />
CHAR(n)<br />
Format (n = 2): mm<br />
Example: 59<br />
Format: (n = 4): mmmm<br />
Example: 0059<br />
CHAR(n + 3 + m + (1 if m > 0, otherwise<br />
0))<br />
Format (n = 2, m = 0): mm:ss<br />
Example: 59:59<br />
Format: (n = 4, m = 4): mmmm:ss.ssss<br />
Example: 0059:59.1234<br />
CHAR(n + m + (1 if m > 0, otherwise 0))<br />
Format (n = 2, m = 0): ss<br />
Example: 59<br />
Format: (n = 4, m = 4): ssss.ssss<br />
Example: 0059.1234<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 141
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
FILLER<br />
FILLER<br />
Purpose<br />
The FILLER command describes a named or unnamed field as filler which is not to be sent to<br />
<strong>Teradata</strong> <strong>Data</strong>base. Only fields relevant to this <strong>Teradata</strong> T<strong>Pump</strong> task need to be specified.<br />
Syntax<br />
.FILLER<br />
fieldname<br />
startpos<br />
datadesc<br />
;<br />
3021A023<br />
where<br />
Syntax Element<br />
fieldname<br />
startpos<br />
datadesc<br />
Description<br />
Name of an input record field to which a nullexpr of a FIELD command refers;<br />
or to which a “condition” expression of the IMPORT command’s APPLY<br />
clause refers<br />
The only reason for naming a filler field is to enable one of these expressions to<br />
refer to it. A fieldname must obey the same rules for its construction as<br />
<strong>Teradata</strong> SQL column names.<br />
The reason for describing a field that is not to be sent to <strong>Teradata</strong> <strong>Data</strong>base<br />
and is not used in any of the expressions mentioned in the previous paragraph<br />
is to make it possible to specify startpos as an asterisk for subsequent fields of<br />
the input records. If the use of the asterisk is not important, fields that do not<br />
participate in the <strong>Teradata</strong> T<strong>Pump</strong> do not need to be defined.<br />
Starting position of a field of the data records in an external data source<br />
It may be specified as an unsigned decimal integer, which is a character<br />
position starting with 1, or as an asterisk, which is the next available character<br />
position beyond the preceding field.<br />
Note that where input records may be continued by use of the CONTINUEIF<br />
condition, a startpos specified as an unsigned integer refers to a character<br />
position in the final concatenated result from which the continuation<br />
indicators have been removed. Refer to the description of the condition<br />
parameter of the LAYOUT command.<br />
Type and length of data in the field<br />
142 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
FILLER<br />
Usage Notes<br />
Example<br />
One or more FILLER commands may be intermixed with the FIELD command or the TABLE<br />
command. These commands must follow a LAYOUT command.<br />
This example illustrates the use of the GRAPHIC data types in support of kanji or multibyte<br />
character data. The FILLER statement describing the input data set or file can contain<br />
GRAPHIC data types.<br />
.LAYOUT KANJIDATA;<br />
.FIELD EMPNO * SMALLINT;<br />
.FIELD LASTNAME * GRAPHIC(30);<br />
.FILLER FIRSTNAME * GRAPHIC(30);<br />
.FIELD JOBTITLE * VARGRAPHIC(30);<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 143
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IF, ELSE, and ENDIF<br />
IF, ELSE, and ENDIF<br />
Purpose<br />
<strong>Teradata</strong> T<strong>Pump</strong> provides a structure of IF, ELSE, and ENDIF commands for the conditional<br />
control of execution processes. Conditional execution works as follows:<br />
Syntax<br />
.IF<br />
conditional expression<br />
statements to execute if TRUE<br />
THEN<br />
;<br />
.ELSE<br />
;<br />
.ENDIF ;<br />
statements to resume with<br />
statements to execute if FALSE<br />
3021A024<br />
where<br />
Syntax Element<br />
conditional<br />
expression<br />
statements to execute<br />
if TRUE<br />
statements to execute<br />
if FALSE<br />
statements to resume<br />
with<br />
Description<br />
User-defined variables or pre-defined system variables following the IF<br />
command, whose condition (TRUE or FALSE) triggers the execution of<br />
alternative groups of statements<br />
Statements to be executed whenever the conditional expression following<br />
the IF command evaluates as TRUE<br />
Statements following the optional ELSE command which execute only<br />
when the conditional expression following the IF command evaluates as<br />
FALSE<br />
Statements following the ENDIF command to terminate the conditional<br />
statement execution process and resume the normal command sequence<br />
Usage Notes<br />
The conditional expression in the IF command may consist of either user-defined variables or<br />
predefined system variables.<br />
The ELSE command clause is optional. ELSE is used only when there are statements to be<br />
executed when the condition is evaluated as false. Conditional expression is an expression<br />
144 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IF, ELSE, and ENDIF<br />
which can be evaluated as either true or false. When evaluation of the expression returns a<br />
numeric result, 0 is interpreted as false; nonzero results are interpreted as true. See the “Utility<br />
Variables” on page 62.<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports the nesting of IF commands to a level of 100.<br />
Any ELSE or ENDIF commands must be present in their entirety and cannot be composed<br />
simply of variables in need of substitution.<br />
Commands and statements following an IF, ELSE, or ENDIF structure that are not executed<br />
are not parsed and do not have their variables substituted.<br />
Example 1<br />
<strong>Teradata</strong> T<strong>Pump</strong> is case sensitive when doing a compare on an &SYS system variable. The<br />
RUN FILE command does not execute because the substituted values returned in this example<br />
are all in uppercase. This factor must be considered when creating a script to force the<br />
execution of a predetermined sequence of events. If, in line 0003, 'FRI' was used, the compare<br />
would work and the RUN FILE command would execute.<br />
0003 .IF '&SYSDAY' = 'Fri' THEN;<br />
14:10:28 - FRI MAY 09, 1997<br />
UTY2402 Previous statement modified to:<br />
0004 .IF 'FRI' = 'Fri' THEN;<br />
0005 .RUN FILE UTNTS38;<br />
0006 .ENDIF;<br />
Example 2<br />
In Example 2, the user has created the table named &TABLE and a variable named<br />
CREATERC, into which is set the system return code resulting from the execution of the<br />
CREATE TABLE statement. If the table name has not already been used, and the return code is<br />
not zero, the return code evaluates to an error condition and the job logs off with the error<br />
code displayed.<br />
0010 .SET CREATERC TO &SYSRC;<br />
0011 .IF &CREATERC = 3803 /* Table &TABLE already exists */ THEN;<br />
UTY2402 Previous statement modified to:<br />
0012 .LOGOFF 08;<br />
0013 .RUN FILE RUN01;<br />
0014 .ELSE<br />
0015 .IF &CREATERC 0 THEN<br />
0016 .LOGOFF &CREATRC;<br />
0017 .ENDIF<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 145
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IMPORT<br />
IMPORT<br />
Purpose<br />
The IMPORT command identifies a source for data input. By referencing the LAYOUT<br />
command and DML command, IMPORT ties the previous commands together. The input<br />
data source used for IMPORT depends on whether the <strong>Teradata</strong> T<strong>Pump</strong> utility is running on<br />
an IBM z/OS client, or on a network-attached client platform, as shown in the following<br />
syntax diagram.<br />
Syntax<br />
For Channel-Attached Client Systems:<br />
.IMPORT<br />
INFILE ddname<br />
AXSMOD name<br />
'init-string'<br />
A<br />
B<br />
A<br />
B<br />
HOLD<br />
FREE<br />
INMOD modulename<br />
USING (parms)<br />
C<br />
C<br />
FROM m<br />
FOR n<br />
THRU k<br />
D<br />
D<br />
FORMAT<br />
VARTEXT<br />
'c'<br />
3<br />
E<br />
DISPLAY ERRORS<br />
NOSTOP<br />
E<br />
LAYOUT layoutname<br />
F<br />
F ;<br />
APPLY label<br />
WHERE condition<br />
3021A004<br />
146 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IMPORT<br />
For Network-Attached Client Systems:<br />
.IMPORT<br />
INFILE filename<br />
AXSMOD name<br />
'init-string'<br />
A<br />
B<br />
A<br />
B<br />
INMOD modulename<br />
USING (parms)<br />
FROM m<br />
FOR n<br />
THRU k<br />
C<br />
C<br />
FORMAT<br />
FASTLOAD<br />
BINARY<br />
TEXT<br />
UNFORMAT<br />
VARTEXT<br />
'c '<br />
3<br />
D<br />
DISPLAY ERRORS<br />
NOSTOP<br />
D LAYOUT layoutname<br />
;<br />
APPLY label<br />
WHERE condition<br />
where<br />
3021A025<br />
Syntax Element<br />
Description<br />
INFILE ddname External data source that contains the input records on channel-attached z/<br />
OS client systems. In z/OS, this is a DDNAME.<br />
If DDNAME is specified, <strong>Teradata</strong> T<strong>Pump</strong> reads data records from the<br />
specified source. If modulename is also specified, <strong>Teradata</strong> T<strong>Pump</strong> passes the<br />
records it reads to the specified module.<br />
The DDNAME must obey the applicable rules of the external system.<br />
A DDNAME must obey the same construction rules as <strong>Teradata</strong> SQL column<br />
names except that:<br />
• The “at” character (@) is allowed as an alphabetic character<br />
• The underscore character (_) is not allowed<br />
If the DDNAME represents a data source on magnetic tape, the tape may be<br />
either labeled or nonlabeled, as supported by the operating system.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 147
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IMPORT<br />
Syntax Element<br />
AXSMOD name<br />
Description<br />
Name of the access module file to be used to import data<br />
The names of the access module files are:<br />
<strong>Teradata</strong> OLE DB Access Module<br />
oledb_axsmod.dll on Microsoft® Windows platforms<br />
Named Pipes Access Module<br />
• np_axsmod.sl on Hewlett-Packard® HP-UX platforms<br />
• np_axsmod.so on IBM® AIX®, Sun® Solaris® SPARC®, Sun® Solaris®<br />
Opteron®, and Novell® SUSE® Linux Enterprise and Red Hat® Enterprise<br />
Linux® Advanced Server platforms, z/Linux,]<br />
• np_axsmod.dll on Windows platforms<br />
Note: When using <strong>Teradata</strong> T<strong>Pump</strong> latency option with Named Pipe<br />
Access Module, the Named Pipe Access Module parameter file should use<br />
need_full_block = no option.<br />
<strong>Teradata</strong> WebSphere® MQ Access Module (client version)<br />
• libmqsc.sl on HP-UX platforms<br />
• libmqsc.so on IBM AIX, z/Linux, Sun Solaris SPARC, Solaris Opteron, and<br />
Linux platforms<br />
• libmqsc.dll on Windows platforms<br />
<strong>Teradata</strong> WebSphere® MQ Access Module (server version)<br />
• libmqs.sl on HP-UX platforms<br />
• libmqs on IBM z/OS/ESA platforms<br />
• libmqs.so on IBM AIX, z/Linux, Sun Solaris SPARC, Solaris Opteron, and<br />
Linux platforms<br />
• libmqs.dll on Windows platforms<br />
A custom shared library file name can be used for a custom access module.<br />
The AXSMOD option is not required for importing:<br />
• Disk files on either network- or channel-attached client systems<br />
• Magnetic tape files on channel-attached client systems<br />
It is required for importing magnetic tape and other types of files on<br />
network-attached client systems.<br />
Refer to <strong>Teradata</strong> Tools and Utilities Access Module Reference for more<br />
information about the specific access modules.<br />
<strong>Teradata</strong> Access Module for JMS<br />
• libjmsam.so on IBM AIX, Sun Solaris SPARC, Solaris Opteron, and Red<br />
Hat Linux platforms<br />
• libjmsam.sl on HP-UX<br />
• libjmsam.dll on Windows platforms<br />
'init-string'<br />
Optional initialization string for the access module<br />
148 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IMPORT<br />
Syntax Element<br />
INFILE filename<br />
HOLD<br />
FREE<br />
INMOD<br />
modulename<br />
Description<br />
Fully qualified UNIX or Windows path name for an input file on networkattached<br />
client systems<br />
If the path name has embedded white space characters, the entire path name<br />
must be enclosed in single or double quotes.<br />
To specify the INFILE filename, the data is read from the specified source. To<br />
specify the INMOD modulename, the data is passed to the specified module.<br />
Default condition to not deallocate the input tape device specified by ddname<br />
when the import operation completes on channel-attached client systems<br />
Instead, the HOLD specification deallocates the device when the entire<br />
<strong>Teradata</strong> T<strong>Pump</strong> operation completes.<br />
Deallocation of the tape input device specified by ddname when the import<br />
operation completes on channel-attached client systems<br />
When de-allocated, any attempt to open the input device, either in the same<br />
<strong>Teradata</strong> T<strong>Pump</strong> utility task or in another task within the same script,<br />
produces an undefined ddname error.<br />
The default is to not deallocate the device.<br />
Optional user-written routine for preprocessing the input data<br />
In z/OS, the modulename is the name of a load module. In UNIX and<br />
Windows, it is the pathname for the INMOD executable code file.<br />
The modulename must obey the applicable rules of the external system.<br />
A modulename must obey the same construction rules as <strong>Teradata</strong> SQL<br />
column names except that on channel-attached client systems:<br />
• The “at” character (@) is allowed as an alphabetic character<br />
• The underscore character (_) is not allowed<br />
When both the INFILE fileid and the INMOD modulename parameters are<br />
specified, the input file is read and the data is passed to the INMOD routine<br />
for preprocessing.<br />
If the INFILE fileid parameter is not specified, the INMOD routine must<br />
provide the input data record.<br />
Note: When an INMOD routine is used with the INFILE specification,<br />
<strong>Teradata</strong> T<strong>Pump</strong> performs the file read operation, and the INMOD routine<br />
acts as a pass-through filter.<br />
Because the FDL-compatible INMOD routine must always perform the file<br />
read operation, an FDL-compatible INMOD routine cannot be used with the<br />
INFILE specification of a <strong>Teradata</strong> T<strong>Pump</strong> IMPORT command.<br />
Note: On some versions of UNIX, ./ prefix characters may have to be added<br />
to the modulename specification if the module is in the current directory.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 149
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IMPORT<br />
Syntax Element<br />
USING (parms)<br />
FROM m<br />
FOR n<br />
THRU k<br />
Description<br />
Character string with the parameters passed to the user exit routine<br />
The parms string can include one or more character strings, each delimited<br />
on either end by an apostrophe or quotation mark.<br />
Maximum size of the parms string is 1K bytes.<br />
Parentheses within delimited character strings or comments have the same<br />
syntactical significance as alphabetic characters.<br />
Before passing the parms string to the user exit routine, the following items<br />
are replaced with a single blank character:<br />
• Each comment.<br />
• Each consecutive sequence of white space characters, such as blank, tab<br />
and so on, that appears outside of delimited strings.<br />
The entire parms string must be enclosed in parentheses. On channelattached<br />
client systems, the parentheses are included in the string passed to<br />
the user exit routine.<br />
Note: The parms string must be FDLINMOD for the user exit routines<br />
written for the prior Pascal version of the FastLoad utility (program<br />
FASTMAIN).<br />
Logical record number, as an integer, of the record in the identified data<br />
source where processing is to begin<br />
If a FROM m specification is not used, <strong>Teradata</strong> T<strong>Pump</strong> begins processing<br />
with the first record received from the data source.<br />
Number of records, as an integer, starting at record m, to be processed<br />
If a FOR n or a THRU k specification is not used, <strong>Teradata</strong> T<strong>Pump</strong> continues<br />
processing through the last record obtained from the data source.<br />
Logical record number, as an integer, of the record in the identified data<br />
source where processing is to end<br />
If a THRU k or a FOR n specification is not used, <strong>Teradata</strong> T<strong>Pump</strong> continues<br />
processing through the last record obtained from the data source.<br />
150 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IMPORT<br />
Syntax Element<br />
FORMAT<br />
Description<br />
Record format of the input file<br />
The format can be:<br />
FASTLOAD—A 2-byte integer, n, followed by n bytes of data and an end-ofrecord<br />
marker (either X'0A' or X'0D').<br />
BINARY—A 2-byte integer, n, followed by n bytes of data.<br />
TEXT—An arbitrary number of bytes, followed by an end-of-record marker<br />
which is a:<br />
• Line feed (X'0A') on UNIX platforms.<br />
• Carriage-return and line-feed pair (X'0D0A') on Windows platforms.<br />
TEXT format should only be specified for character data. Do not specify<br />
TEXT format for binary data, such as, PERIOD data.<br />
UNFORMAT—defined by FIELD, FILLER, and TABLE commands of the<br />
specified layout.<br />
Note: When using UNFORMAT formatting in z/OS, ensure that the data<br />
stream and data source are consistent with the layout defined in the utility<br />
script. Discrepancies in the length of the data stream could result in data<br />
corruption.<br />
VARTEXT—in variable-length text record format, with each field separated<br />
by a delimiter. Rules for a delimiter are:<br />
• No control characters other than a TAB character can be used as a<br />
delimiter.<br />
• Any character that appears in the data cannot be used as a delimiter.<br />
• Delimiters can only be up to 10 single-characters long.<br />
If a FORMAT option is not specified, the default is FASTLOAD.<br />
Note: On the mainframe platform, when access module is not used, the<br />
default is the input data read record by record and the LAYOUT is applied to<br />
each read record.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 151
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IMPORT<br />
Syntax Element<br />
'c'<br />
Description<br />
Optional specification of the delimiter characters that separate fields in the<br />
variable-length text records of the input data source<br />
The default, if a 'c' specification is not used, is the vertical bar character ( | ).<br />
When the character set of the job script is different from the client character<br />
set used for the job (for example, on z/OS the job script must be in <strong>Teradata</strong><br />
EBCDIC when using the UTF8 client character set, or UTF-16 client<br />
character set can be used with the job script in UTF8), <strong>Teradata</strong> T<strong>Pump</strong> will<br />
translate the effective delimiter from the script character set form to the client<br />
character set form before separating the fields with it.<br />
For example, when the client character set is UTF-16 and the script character<br />
set is UTF8, if the following command is given:<br />
… FORMAT VARTEXT '-' ...<br />
<strong>Teradata</strong> T<strong>Pump</strong> translates '-' from the UTF8 form to the UTF-16 form and<br />
then separate the fields in the record according to the UTF-16 form of '-'.<br />
Similarly, on the mainframe, when the client character set is UTF8 and the<br />
script character set is <strong>Teradata</strong> EBCDIC, if the following command is given:<br />
… FORMAT VARTEXT '6A'xc ...<br />
<strong>Teradata</strong> T<strong>Pump</strong> interprets x'6A' according to <strong>Teradata</strong> EBCDIC and<br />
translates it to the corresponding Unicode code point, U+007C "VERTICAL<br />
LINE", and uses the UTF8 encoding scheme of U+007C, 0x7C (which is '|' in<br />
7-bit ASCII), as the delimiter character for the record.<br />
Caution: When using the UTF8 client set on the mainframe, examine the<br />
definition in the International Character Set Support manual to<br />
determine the code points of the special characters required.<br />
Different versions of EBCDIC do not always agree as to the<br />
placement of these characters.<br />
For example, the code point of '|' in most IBM EBCDIC code pages<br />
is x'4F'. If a '|' is specified as the delimiter in the script or the<br />
delimiter to default in a system environment using such an IBM<br />
EBCDIC code page is left, (which is essentially the same as<br />
specifying '|'), but the UTF8 data uses x'7C' ('|' in Unicode) as the<br />
delimiter, the job will run into errors because:<br />
• the code point of x'4F' in <strong>Teradata</strong> EBCDIC maps to U+008D but not<br />
U+007C, and<br />
• the delimiter must use single-byte characters when it is in the client<br />
character set form.<br />
DISPLAY ERRORS<br />
NOSTOP<br />
LAYOUT<br />
layoutname<br />
APPLY label<br />
Optional keyword specification that writes input data records that produce<br />
errors to the standard error file<br />
Optional keyword specification that inhibits the <strong>Teradata</strong> T<strong>Pump</strong><br />
termination in response to an error condition associated with a variablelength<br />
text record<br />
Layout of the input record, as specified by a previous command<br />
Error treatment options specified by a previous DML LABEL command for<br />
subsequent INSERT, UPDATE, or DELETE statements<br />
152 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IMPORT<br />
Syntax Element<br />
WHERE condition<br />
Description<br />
Condition that determines whether the indicated label options are applied to<br />
the records and sent to <strong>Teradata</strong> <strong>Data</strong>base, where:<br />
• condition true = yes<br />
• condition false = no<br />
The condition specification can reference:<br />
• Any combination of fields defined in the currently active layout<br />
• System and user-defined constants and variables<br />
• The fieldname1 specified in commands<br />
When VARTEXT is specified, the <strong>Teradata</strong> T<strong>Pump</strong> utility assumes that the<br />
input data is variable-length text fields separated by a field delimiter<br />
character. The utility parses each input data record on a field-by-field basis,<br />
and creates a VARCHAR field for each input text field.<br />
When the character set of the job script is different from the client character<br />
set used for the job (for example, on z/OS the job script must be in <strong>Teradata</strong><br />
EBCDIC when using the UTF8 client character set, or UTF-16 client<br />
character set can be used with the job script in UTF8), <strong>Teradata</strong> T<strong>Pump</strong><br />
translates the string constants specified in the condition and the import data<br />
referenced in the condition to the same character set before evaluating the<br />
condition.<br />
For example, when the client character set is UTF-16 and the script character<br />
set is UTF8, if the following command is given<br />
… APPLY lable1 WHERE C1 = 'INSERT';<br />
<strong>Teradata</strong> T<strong>Pump</strong> translates the data in the C1 field to the UTF8 form and<br />
compares it with the UTF8 form of 'INSERT' to obtain the evaluation result.<br />
Similarly, on the mainframe, when the client character set is UTF8 and the<br />
script character set is <strong>Teradata</strong> EBCDIC, if the following command is given:<br />
… APPLY lable2 WHERE C2 = 'DELETE';<br />
<strong>Teradata</strong> T<strong>Pump</strong> translates the data in the C2 field from the UTF8 form to the<br />
<strong>Teradata</strong> EBCDIC form and perform the comparison with the <strong>Teradata</strong><br />
EBCDIC form of 'DELETE'.<br />
Caution:<br />
When using the UTF8 client set on the mainframe, be sure to<br />
examine the definition in International Character Set Support to<br />
determine the code points of the special characters required.<br />
Different versions of EBCDIC do not always agree as to the<br />
placement of these characters. The mappings between <strong>Teradata</strong><br />
EBCDIC and Unicode can be referred to in Appendix E of<br />
International Character Set Support.<br />
Usage Notes<br />
A maximum of four IMPORT commands can be used in a single <strong>Teradata</strong> T<strong>Pump</strong> load task. A<br />
single load comprises the set of commands and statements bounded by a BEGIN LOAD-END<br />
LOAD command pair. If the number of IMPORTs sent to <strong>Teradata</strong> <strong>Data</strong>base for the load<br />
exceeds four, an error message is logged. <strong>Teradata</strong> T<strong>Pump</strong> has been limited to four IMPORTs<br />
per load in order to limit the amount of memory needed to keep track of job-related statistics.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 153
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IMPORT<br />
The maximum number of INSERT, UPDATE, and DELETE statements that can be referenced<br />
in an IMPORT is 128. The 128th DML which would cause the insertion of the DML sequence<br />
number of 128 for the DMLSEQ field in the error table could lead to <strong>Teradata</strong> <strong>Data</strong>base 3520<br />
error.<br />
The only DML statements that are candidates for application by an IMPORT command are<br />
those within the scope of DML commands whose labels appear in one or more of the<br />
IMPORT command’s APPLY clauses. The referenced DML commands and their following<br />
DML statement(s) must appear between the BEGIN LOAD command that defines the task<br />
and the referencing IMPORT commands. A statement or group of statements is applied if no<br />
condition is specified, or if the specified condition is true.<br />
<strong>Teradata</strong> T<strong>Pump</strong> permits multiple statements to be applied to the same data record in either of<br />
two ways. First, if an APPLY clause refers to a label whose scope includes multiple DML<br />
statements, each of these statements is applied to the same data record under the same<br />
condition specified in the clause. Second, if multiple APPLY clauses are used, each can refer to<br />
the label of a different DML statement or group of statements. Each label’s statements are<br />
applied to the same data record under that condition specified in the respective clause. These<br />
features allow the same data record to be applied to different tables under the same or<br />
differing conditions.<br />
VARTEXT Record Usage<br />
When VARTEXT is specified, <strong>Teradata</strong> T<strong>Pump</strong> assumes that the input data is variable-length<br />
text fields separated by a field delimiter character. It parses each input data record on a fieldby-field<br />
basis, and creates a VARCHAR field for each input text field.<br />
When using the VARTEXT specification, VARCHAR, VARBYTE, and LONG VARCHAR are<br />
the only valid data type specifications to use in <strong>Teradata</strong> T<strong>Pump</strong> layout FIELD and FILLER<br />
commands.<br />
Two consecutive delimiter characters direct <strong>Teradata</strong> T<strong>Pump</strong> to null the field corresponding to<br />
the one immediately following the first delimiter character.<br />
Also, if the last character in a record is a delimiter character, and there is at least one more field<br />
to be processed, then <strong>Teradata</strong> T<strong>Pump</strong> nulls the field corresponding to the next one to be<br />
processed, as defined in the layout FIELD and FIELD command.<br />
The total number of fields in each input record must be equal to or greater than the number of<br />
fields described in the <strong>Teradata</strong> T<strong>Pump</strong> layout FIELD and FIELD commands.<br />
If it is less, <strong>Teradata</strong> T<strong>Pump</strong> generates an error message. If it is more, <strong>Teradata</strong> <strong>Data</strong>base<br />
ignores the extra fields.<br />
The last field of a record does not have to end with a delimiter character. It can end with a<br />
delimiter character, but it is not required.<br />
When <strong>Teradata</strong> T<strong>Pump</strong> encounters an error condition in an input record, it normally discards<br />
the record and terminates. When loading variable-length text records, inhibit either or both of<br />
these functions by specifying the error-handling options:<br />
• DISPLAY ERRORS<br />
154 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IMPORT<br />
APPLY Example<br />
• NOSTOP<br />
If NOSTOP is specified, <strong>Teradata</strong> T<strong>Pump</strong> will not terminate even if an error is encountered.<br />
By specifying both options and redirecting STDERR to a file location instead of the terminal<br />
screen, the <strong>Teradata</strong> T<strong>Pump</strong> job runs to completion and saves all the error records. Then the<br />
error records can be manually modified and loaded into the table.<br />
All IMPORT commands for a <strong>Teradata</strong> T<strong>Pump</strong> task must appear between the BEGIN LOAD<br />
and END LOAD commands for the task.<br />
<strong>Teradata</strong> T<strong>Pump</strong> imposes several syntax rules for the parms string for an INMOD user exit<br />
routine. On entry to any INMOD user exit routine for <strong>Teradata</strong> T<strong>Pump</strong>, the conventional<br />
parameter register points to a parameter list of two 32-bit addresses used to communicate<br />
with the INMOD.<br />
At the end of an IMPORT, an environmental variable is established for each DML command<br />
executed. <strong>Teradata</strong> T<strong>Pump</strong> variables are not constrained to 30 characters. These variables<br />
contain the activity counts associated with each statement. The variables created are of the<br />
form:<br />
&IMP __<br />
where<br />
n = the number of the IMPORT, from one through four.<br />
Apply label = the label of the clause containing the DML command in question.<br />
x = the number of the statement within the containing APPLY clause.<br />
The following script is an example of a <strong>Teradata</strong> T<strong>Pump</strong> job using the APPLY keyword to<br />
create conditional clauses to apply DML INSERTs, UPDATEs, and UPSERTs to the IMPORT.<br />
.BEGIN LOAD SESSIONS 34;<br />
.LAYOUT EQTTB535;<br />
.FIELD Pool_Upd_Code * CHAR(01);<br />
.FIELD Eqmt_Init<br />
* CHAR(04);<br />
....<br />
.DML LABEL UPSERTAC<br />
DO INSERT FOR MISSING UPDATE ROWS;<br />
UPDATE EQTDBT50.EQTTB535_TAL SET<br />
TCS_POOL_IDFR_NUM =:TCS_POOL_IDFR_NUM<br />
.....<br />
WHERE<br />
.....<br />
;<br />
INSERT INTO EQTDBT50.EQTTB535_TAL<br />
VALUES(<br />
POOL_EXPN_DATE =:POOL_EXPN_DATE (DATE, FORMAT 'YYYYMMDD')<br />
.....<br />
);<br />
.DML LABEL UPSERTDL;<br />
UPDATE EQTDBT50.EQTTB535_TAL SET<br />
.....<br />
WHERE<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 155
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
IMPORT<br />
.....<br />
;<br />
.IMPORT INFILE INFILE<br />
LAYOUT EQTTB535<br />
APPLY UPSERTAC WHERE (POOL_UPD_CODE = 'C'<br />
OR POOL_UPD_CODE = 'A')<br />
APPLY UPSERTDL WHERE POOL_UPD_CODE = 'D'<br />
;<br />
.END LOAD;<br />
/* For the upsert: */<br />
/* (first statement in .DML UPSERTAC) */<br />
/* make sure we have the 50 updates */<br />
.IF &IMP1_UPSERTAC_1 50 THEN<br />
.LOGOFF 100;<br />
/* ... and 50 inserts */<br />
/* (second statement in .DML UPSERTAC) */<br />
.IF &IMP1_UPSERTAC_2 50 THEN<br />
.LOGOFF 101;<br />
/* And for the plain update: */<br />
/* (first statement in .DML UPSERTDL) */<br />
/* we should have 10 of these. */<br />
.IF &IMP1_UPSERTDL_1 10 THEN<br />
.LOGOFF 102;<br />
.LOGOFF;<br />
156 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
INSERT<br />
INSERT<br />
Purpose<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports the <strong>Teradata</strong> SQL INSERT statement, which adds new rows to a<br />
table by directly specifying the row data to be inserted.<br />
Syntax<br />
INSERT tname .*<br />
;<br />
INS INTO ,<br />
VALUES ( :fieldname )<br />
,<br />
expression<br />
( cname )<br />
3021A026<br />
where<br />
Syntax Element<br />
tname<br />
cname<br />
fieldname<br />
expression<br />
Description<br />
Table that is to receive rows created from input data records<br />
If the table is not explicitly qualified by database name, the default database<br />
qualifies it.<br />
Column of the specified table that is to receive the value from a field of<br />
matching input records, where the value is identified by the corresponding<br />
entry in the fieldname list<br />
Field of an input record, whose value is given to a column of the specified table<br />
that is identified by the corresponding entry in the cname clause in this<br />
statement<br />
If this statement did not specify a cname, the object’s CREATE statement<br />
provides the corresponding column identifier. This assumes that all columns<br />
from the table correspond to those specified in the original CREATE<br />
statement.<br />
Alternative to the fieldname clause, an expression that includes one or more<br />
actual fieldnames as terms may instead be used<br />
Usage Notes<br />
The following notes describe how to use an INSERT statement following a DML command.<br />
An INSERT statement may also be used in the support environment; normal rules for INSERT<br />
are followed in that case.<br />
One way of specifying the applicable DML statements is to relate each field name to the name<br />
of the column to which the field’s data is applied. Another way tells <strong>Teradata</strong> T<strong>Pump</strong> to apply<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 157
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
INSERT<br />
Temporal Semantics<br />
Example 1<br />
Example 2<br />
the first nonfiller field of a record that is sent to <strong>Teradata</strong> <strong>Data</strong>base to the first defined column<br />
of the affected table, the second nonfiller field to the second column, and so on.<br />
<strong>Teradata</strong> T<strong>Pump</strong> converts INSERT statements into macro equivalents and, depending on the<br />
packing specified, submits multiple statements on one request.<br />
To insert records into the table identified by tname, the username specified in the LOGON<br />
command must have the INSERT privilege for the table.<br />
A value must be specified for every column, either explicitly or by default.<br />
For <strong>Teradata</strong> T<strong>Pump</strong> use, if the object of the INSERT statement is a view, it must not specify a<br />
join. <strong>Teradata</strong> T<strong>Pump</strong> operates only on single table statements so INSERT statements must<br />
not contain any joins.<br />
The correspondence between the fields of data records to be inserted into a table, and the<br />
columns of the table, can be specified in any of four ways. These appear in the following<br />
examples, using targetable as the table or view name.<br />
The maximum number of INSERT, UPDATE, and DELETE statements that can be referenced<br />
in an IMPORT is 128. The 128th DML which would cause the insertion of the DML sequence<br />
number of 128 for the DMLSEQ field in the error table could lead to <strong>Teradata</strong> <strong>Data</strong>base 3520<br />
error.<br />
The maximum number of DML statements that can be packed into a request is 2430. The<br />
default number of statements packed is 20.<br />
ANSI/SQL DateTime Specifications<br />
The ANSI/SQL DATE, TIME, TIMESTAMP, and INTERVAL DateTime data types can be used<br />
in <strong>Teradata</strong> SQL CREATE TABLE statements. Specify the data types as column/field modifiers<br />
in INSERT statements.<br />
DML validtime qualifier and NONTEMPORAL semantics are supported. For more<br />
information, see SQL <strong>Data</strong> Manipulation Language and SQL <strong>Data</strong> Manipulation Language<br />
Advanced Topics.<br />
.BEGIN LOAD SESSION number;<br />
.LAYOUT Layoutname;<br />
.TABLE Targetablename;<br />
.DML LABEL DMLlabelname;<br />
INSERT INTO Targetablename.*;<br />
.IMPORT INFILE Infilename LAYOUT Layoutname APPLY DMLlabelname;<br />
.END LOAD;<br />
.LAYOUT lname;<br />
.FIELD first 1 somedatatype;<br />
.FIELD f2nd * anydatatype;<br />
158 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
INSERT<br />
.<br />
.<br />
.<br />
.FIELD flast * datatype;<br />
.DML LABEL label;<br />
INSERT INTO targetable VALUES (:first, :f2nd, ... :flast);<br />
Example 3<br />
Example 4<br />
.LAYOUT lname;<br />
.FIELD first 1 somedatatype;<br />
.FIELD f2nd * anydatatype;<br />
.<br />
.<br />
.<br />
.FIELD flast * datatype;<br />
.DML LABEL label;<br />
INSERT INTO targetable (col1, col2, ... colast)<br />
VALUES (:f2nd, :first, ... :flast);<br />
An input data source contains a series of 10- to 40-byte records. Each record contains the<br />
primary index value (EmpNum) of a row that is to be inserted successively into the Employee<br />
table whose columns are EmpNo, Name, and Salary.<br />
.BEGIN LOAD SESSION number ;<br />
.LAYOUT Layoutname;<br />
.FIELD EmpNum 1 INTEGER;<br />
.FIELD Name * (VARCHAR (30));<br />
.FIELD Sal * (DECIMAL (7,2));<br />
.DML LABEL DMLlabelname;<br />
INSERT Employee (EmpNo, Name, Salary) VALUES (:EmpNum, :Name, :Sal);<br />
.IMPORT INFILE Infilename LAYOUT Layoutname APPLY DMLlabelname;<br />
.END LOAD;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 159
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LAYOUT<br />
LAYOUT<br />
Purpose<br />
The LAYOUT command, in conjunction with the immediately following sequence of FIELD,<br />
FILLER, and TABLE commands, specifies the layout of the externally stored data records.<br />
Syntax<br />
where<br />
.LAYOUT layoutname<br />
;<br />
CONTINUEIF condition<br />
INDICATORS<br />
3021A027<br />
Syntax Element<br />
layoutname<br />
Description<br />
Name assigned to the layout for reference by one or more subsequent IMPORT<br />
commands<br />
A layoutname must obey the same rules for its construction as <strong>Teradata</strong> SQL<br />
column names.<br />
The name specified also may be used in the LAYOUT clause of an IMPORT<br />
command.<br />
160 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LAYOUT<br />
Syntax Element<br />
CONTINUEIF<br />
condition<br />
Description<br />
following:<br />
position = value<br />
where position is an unsigned integer (never an asterisk) that specifies the<br />
starting character position of the field of every input record that contains the<br />
continuation indicator, and where value is the continuation indicator specified<br />
as a character constant or a string constant. <strong>Teradata</strong> T<strong>Pump</strong> uses the length of<br />
the constant as the length of the continuation indicator field.<br />
In the CONTINUEIF option, the condition specified as position = value is<br />
case-sensitive; verify that the correct case has been specified for this parameter.<br />
If the condition is true, <strong>Teradata</strong> T<strong>Pump</strong> forms a single record to be sent to<br />
<strong>Teradata</strong> <strong>Data</strong>base, by concatenating the next input record at the end of the<br />
current record. (The current record is the one most recently obtained from the<br />
external data source.)<br />
If the condition parameter is false, <strong>Teradata</strong> T<strong>Pump</strong> sends to <strong>Teradata</strong> <strong>Data</strong>base,<br />
the current input record either by itself, or as the last of a sequence of<br />
concatenated records.<br />
Note that the starting position of the continuation indicator field is specified as<br />
a character position of the input record. Character positions start with<br />
character position one. <strong>Teradata</strong> T<strong>Pump</strong> removes the continuation indicator<br />
field from the input records so that they are not part of the final concatenated<br />
result.<br />
For other fields whose startpos is specified as an unsigned integer, the startpos<br />
refers to the field position within the final concatenated result. Consequently,<br />
the continuation indicator field cannot be defined as all or part of a field<br />
defined with the FIELD, FILLER, or TABLE commands. Refer to the startpos<br />
parameter of the FIELD command.<br />
When the character set of the job script is different from the client character set<br />
used for the job (for example, on z/OS the job script must be in <strong>Teradata</strong><br />
EBCDIC when using the UTF8 client character set, or UTF-16 client character<br />
set can be used with the job script in UTF8), <strong>Teradata</strong> T<strong>Pump</strong> translates the<br />
specified value, which is either a character constant or a string constant, from<br />
the script character set form to the client character set form before evaluating<br />
the condition. <strong>Teradata</strong> T<strong>Pump</strong> uses the length of the constant in the client<br />
character set form as the length of the continuation indicator field.<br />
Caution:<br />
When using the UTF8 client set on the mainframe, be sure to<br />
examine the definition in International Character Set Support to<br />
determine the code points of the special characters required.<br />
Different versions of EBCDIC do not always agree as to the<br />
placement of these characters.<br />
The mappings between <strong>Teradata</strong> EBCDIC and Unicode can be<br />
referred to in Appendix E of International Character Set Support.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 161
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LAYOUT<br />
Syntax Element<br />
INDICATORS<br />
Description<br />
Condition that the data is in the indicator mode<br />
This means that the first n bytes of each record are indicator bytes, where n is<br />
the rounded-up integer quotient of the number of fields defined by this<br />
LAYOUT command for transmission to <strong>Teradata</strong> <strong>Data</strong>base, divided by 8.<br />
<strong>Teradata</strong> T<strong>Pump</strong> sends all the FIELD commands, including redefines, to<br />
<strong>Teradata</strong> <strong>Data</strong>base. If a field has been defined and then redefined, indicator bits<br />
must be set for both. FILLER commands also need to have indicator bits set.<br />
<strong>Teradata</strong> T<strong>Pump</strong> sends both the defined and the redefined fields to <strong>Teradata</strong><br />
<strong>Data</strong>base. This demonstrates the inefficiency of redefines which cause the<br />
transfer of an extraneous field.<br />
If INDICATORS is specified on the LAYOUT command and the data file does<br />
not contain indicator bytes in each record, the target table will be loaded with<br />
spurious data. Conversely, if INDICATORS is not specified and the data file<br />
contains indicator bytes in each record, the target table will likewise be<br />
corrupted. Exercise caution to guard against either occurrence.<br />
A LAYOUT command that includes the INDICATORS option must accurately<br />
describe all fields of the record to agree with the column descriptions and<br />
ordering of the table from which this indicator-mode data was previously<br />
selected. If the INDICATORS option is specified, <strong>Teradata</strong> T<strong>Pump</strong> sends the<br />
data to <strong>Teradata</strong> <strong>Data</strong>base with indicators.<br />
The NULLIF parameter of the FIELD command can be specified with or<br />
without the INDICATORS option. If NULLIF is specified, <strong>Teradata</strong> T<strong>Pump</strong><br />
sends the data to <strong>Teradata</strong> <strong>Data</strong>base with indicators, whether or not the<br />
INDICATORS option is specified.<br />
Usage Notes<br />
Although there is no explicit limit to the number of LAYOUT commands allowed, there is a<br />
practical limit. The implied limit on usable LAYOUT commands per <strong>Teradata</strong> T<strong>Pump</strong> load is<br />
four, because <strong>Teradata</strong> T<strong>Pump</strong> allows up to four IMPORT commands within a load, and each<br />
IMPORT can reference only one LAYOUT.<br />
A LAYOUT command must be immediately followed by a combination of FIELD, FILLER,<br />
and/or TABLE commands. This sequence of commands, referenced by the layoutname, may<br />
describe one or more record formats contained in one or more client data sources (see<br />
redefinition options for FIELD, FILLER, and TABLE). The LAYOUT command sequence is<br />
terminated by the first subsequent command that is not a FIELD, FILLER, or TABLE<br />
command.<br />
A layoutname may be used by one or more <strong>Teradata</strong> T<strong>Pump</strong> tasks (delimited by BEGIN LOAD<br />
and END LOAD) in a single job step and must be defined prior to any IMPORT commands<br />
that reference it. All IMPORT commands in a single <strong>Teradata</strong> T<strong>Pump</strong> task must reference the<br />
same layoutname in the LAYOUT clause.<br />
162 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LOGDATA<br />
LOGDATA<br />
Purpose<br />
Supplies parameters to the LOGMECH command beyond those needed by the logon<br />
mechanism, such as user ID and password, to successfully authenticate the user. The<br />
LOGDATA command is optional. Whether or not parameters are supplied and the values and<br />
types of parameters depend on the selected logon method. LOGDATA is available only on<br />
network-based platforms.<br />
Syntax<br />
.LOGDATA logdata_string<br />
;<br />
'logdata_string '<br />
2409A054<br />
where<br />
Syntax Element<br />
logdata_string 'logdata_string'<br />
Description<br />
Parameters required for the logon mechanism specified using<br />
“LOGMECH” on page 164<br />
For information about the logon parameters for supported<br />
mechanisms, see Security Administration.<br />
The string is limited to 64 KB and must be in the session<br />
character set.<br />
To specify a string containing white space or other special<br />
characters, enclose the data string in single quotes.<br />
Note: The security feature this command supports is not<br />
supported with the UTF-16 session character set.<br />
Usage Notes<br />
Examples<br />
For more information about logon security, see Security Administration.<br />
If used, the LOGDATA command and the LOGMECH command must precede the LOGON<br />
command. The commands themselves may occur in any order.<br />
The example demonstrates using the LOGDATA, LOGMECH, and LOGON commands in<br />
combination to specify the Kerberos logon authentication method and associated parameters:<br />
.logmech KRB5;<br />
.logdata joe@domain1@@mypassword;<br />
.logon cs4400s3;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 163
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LOGMECH<br />
LOGMECH<br />
Purpose<br />
Identifies the appropriate logon mechanism by name. If the specified mechanism requires<br />
parameters other than user ID and password for authentication, the LOGDATA command<br />
provides these parameters. The LOGMECH command is optional and available only on<br />
network-attached systems.<br />
Syntax<br />
.LOGMECH logmech_name<br />
;<br />
2409A053<br />
where<br />
Syntax Element<br />
logmech_name<br />
Description<br />
Definition of the logon mechanism<br />
For a discussion of supported logon mechanisms, see Security Administration.<br />
The name is limited to 8 bytes; it is not case-sensitive.<br />
Usage Notes<br />
Examples<br />
Every session to be connected requires a mechanism name. If none is supplied, a default<br />
mechanism can be used instead, as defined on either the server or client system in an<br />
XML-based configuration file.<br />
For more information about logon security, see Security Administration.<br />
If used, the LOGDATA and LOGMECH commands must precede the LOGON command. The<br />
commands themselves may occur in any order.<br />
The following example demonstrates using the LOGDATA, LOGMECH, and LOGON<br />
commands in combination to specify the Windows logon authentication method and<br />
associated parameters:<br />
.logmech NTLM;<br />
.logdata joe@domain1@@mypassword;<br />
.logon cs4400s3;<br />
164 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LOGOFF<br />
LOGOFF<br />
Purpose<br />
The LOGOFF command disconnects all active sessions and terminates execution of <strong>Teradata</strong><br />
T<strong>Pump</strong> on the client. An optional return code value may be specified as a conditional or<br />
arithmetic expression, evaluated to a signed integer.<br />
Syntax<br />
.LOGOFF<br />
retcode<br />
;<br />
3021A028<br />
where<br />
Syntax Element<br />
retcode<br />
Description<br />
Completion code returned to the client operating system<br />
If retcode is not specified, <strong>Teradata</strong> T<strong>Pump</strong> returns the value generated by the<br />
error condition.<br />
Usage Notes<br />
Example<br />
<strong>Teradata</strong> T<strong>Pump</strong> tracks the internal error condition code throughout the job and returns<br />
either 0 for complete success, 4 for warnings, 12 for fatal errors, and 16 for no sysprint. These<br />
values are the “error conditions”.<br />
To avoid ambiguity or conflict with standard <strong>Teradata</strong> T<strong>Pump</strong> completion codes, values<br />
greater than 20 should be used. <strong>Teradata</strong> T<strong>Pump</strong> returns the higher value between the value<br />
generated by the error condition and the return code specified in LOGOFF.<br />
If the LOGOFF command processes, this indicates that the highest return code reached was no<br />
more than 4 (warning). Any return code other than 0 or 4 would have terminated the job.<br />
LOGOFF is permitted at any point in the input script and logs off immediately.<br />
Suppose successful execution of a <strong>Teradata</strong> SQL statement (such as CREATE TABLE) is<br />
necessary to prepare for <strong>Teradata</strong> T<strong>Pump</strong>. If it is determined that the statement has failed with<br />
an unacceptable completion code, and if BADRC is set to &SYSRC after the failed SQL<br />
statement, the execution of <strong>Teradata</strong> T<strong>Pump</strong> can be terminated and the unacceptable code<br />
returned to the client by executing this command:<br />
.LOGOFF &BADRC;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 165
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LOGOFF<br />
The restart table is dropped when this command is executed. If execution is terminated before<br />
the LOGOFF command is encountered, the restart table is not dropped, in order to support a<br />
restart at a later time.<br />
If a serious error terminates the program before the LOGOFF command is processed, the<br />
return code output is the value generated by the error condition rather than the optional<br />
retcode specified as a LOGOFF command option.<br />
166 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LOGON<br />
LOGON<br />
Purpose<br />
Syntax<br />
The LOGON command establishes a <strong>Teradata</strong> SQL session between <strong>Teradata</strong> T<strong>Pump</strong> and<br />
<strong>Teradata</strong> <strong>Data</strong>base. Use it to specify the LOGON string for connecting sessions required by<br />
subsequent functions. The ACCEPT and SET commands are valid commands preceding<br />
LOGON and LOGTABLE commands.<br />
Standard LOGON<br />
.LOGON<br />
tdpid /<br />
username<br />
, password<br />
,' acctid '<br />
;<br />
3021A005<br />
Note: On z/OS, with the use of the User Logon Exit routine in TDP, the user name is not<br />
required. See <strong>Teradata</strong> Director Program Reference for more information.<br />
Single Sign On LOGON<br />
.LOGON<br />
tdpid /<br />
username<br />
, password<br />
,'acctid '<br />
;<br />
2409A010<br />
Note: When logon encryption is enabled on the gateway, single sign on is disabled on the<br />
client and standard logon syntax should be used instead.<br />
where<br />
Syntax Element<br />
tdpid<br />
Description<br />
Optional identifier associated with a particular copy of <strong>Teradata</strong> <strong>Data</strong>base<br />
If this field is not specified, the default tdpid, established by the system<br />
administrator, is used.<br />
For channel-attached systems, the tdpid string must be in the form:<br />
TDPn<br />
where n is the TDP identifier<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 167
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LOGON<br />
Syntax Element<br />
username<br />
password<br />
'acctid'<br />
Description<br />
User identifier of up to a 30-character maximum<br />
Optional password associated with the username, up to a 30-character<br />
maximum<br />
<strong>Teradata</strong> <strong>Data</strong>base must be configured to recognize the password specified.<br />
Optional account identifier associated with the username, up to a 30-character<br />
maximum<br />
The string specification must be enclosed in single quotes.<br />
If this field is not specified, a default “acctid” is used.<br />
Usage Notes<br />
Both the LOGON command and the LOGTABLE command are required to set up the<br />
<strong>Teradata</strong> T<strong>Pump</strong> support environment. Use them in any order, but they must precede any<br />
other commands. However, a RUN FILE command can be used to identify a file containing<br />
the LOGON command before the LOGON and LOGTABLE commands.<br />
LOGON and LOGTABLE commands typically occur as:<br />
.logtable logtable001;<br />
.logon tdpx/me,paswd;<br />
When the LOGON command is executed, the initial <strong>Teradata</strong> T<strong>Pump</strong> utility session is logged<br />
on. The logon information is saved and re-used when processing the BEGIN LOAD command<br />
to connect the appropriate number of sessions.<br />
The parameters (tdpid, username, password, and “acctid”) are optional and are used in all<br />
sessions established with <strong>Teradata</strong> <strong>Data</strong>base. The LOGON command may only occur once.<br />
The period (.) preceding LOGON is also optional.<br />
The tdpid identifier specifies a particular <strong>Teradata</strong> <strong>Data</strong>base. See the system or site<br />
administrator for the identifier planned to use. If a tdpid is not specified and the site<br />
administrator has not updated the System Parameter Block, the default identifier is <strong>Teradata</strong><br />
<strong>Data</strong>base. The long form of this parameter, tdpx, should be used to avoid CLI errors that can<br />
occur when the short form is used.<br />
The tdpid parameter is optional if the site has only one TDP, if a TDP command was<br />
previously executed, or if the default TDP was selected. This parameter is not case-sensitive.<br />
<strong>Teradata</strong> T<strong>Pump</strong> does not prompt for a username or password. If either or both of these are<br />
required, <strong>Teradata</strong> T<strong>Pump</strong> fails and reports the error. Both of these parameters may be<br />
optional if a logon exit is used.<br />
Where possible, do not use special characters in the acctid parameter string. Although acctid<br />
may contain special characters, the special characters might be interpreted differently by<br />
different output devices. Therefore, a script containing special characters might have to be<br />
modified if the output is routed to another device. If the acctid contains an apostrophe (single<br />
quote) character, use either the second form of the LOGON command, which is delimited by<br />
quotes, or double the apostrophe character as follows:<br />
168 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LOGON<br />
.LOGON 0/fml,fml,"engineering’s account"<br />
or<br />
.LOGON 0/fml,fml,'engineering"s account"<br />
If the acctid does not contain an apostrophe, the two LOGON command forms are the same.<br />
If any parameter is entered incorrectly, the logon fails and <strong>Teradata</strong> T<strong>Pump</strong> returns an error<br />
message. For security reasons, the error message does not state in which parameter the error<br />
occurred.<br />
If password security on a channel-attached client is a concern, use the RUN FILE command to<br />
alter the script to accept the LOGON command from another dataset/file under the control of<br />
ACF2 or another client-resident security system. For example:<br />
//stepname EXEC PGM=TPUMP,...<br />
//SECURE DD DSN = FOO<br />
//SYSIN DD *<br />
.LOGTABLE MYTABLE;<br />
.RUN SECURE;<br />
Then log on by simply entering the LOGON command with a valid user name and no<br />
password if the system administrator has granted this option. As an example, to log onto<br />
<strong>Teradata</strong> T<strong>Pump</strong> as user ABC with ABC as the password (which is masked from view on the<br />
output listing), specify the LOGON command on one line as follows:<br />
.logon ABC,ABC<br />
When the command is entered, <strong>Teradata</strong> T<strong>Pump</strong> displays something like:<br />
**** 15:12:47 UTY8400 <strong>Teradata</strong> <strong>Data</strong>base Version: 13.10.00.00<br />
**** 15:12:47 UTY8400 Default character set: ASCII<br />
**** 15:12:47 UTY8400 Current RDBMS has UDT support<br />
**** 15:12:47 UTY8400 Maximum supported buffer size: 1M<br />
**** 15:12:47 UTY8400 Upsert supported by RDBMS server<br />
**** 15:12:47 UTY8400 <strong>Data</strong> Encryption supported by RDBMS server<br />
**** 15:12:47 UTY8400 Array Support supported by RDBMS server<br />
**** 15:12:48 UTY6211 A successful connect was made to the RDBMS.<br />
Logon exits are supported on both mainframe and UNIX clients. The CLIv2 User Logon Exit<br />
routine can be used to make some or all logon string elements optional.<br />
LOGON is used with the LOGTABLE command, both of which are required. LOGON and<br />
LOGTABLE may appear in any order. If LOGON is entered first, a warning that LOGTABLE is<br />
required is returned.<br />
The parameters (tdpid, username, password, and “acctid”) are used in all sessions established<br />
with <strong>Teradata</strong> <strong>Data</strong>base. The LOGON command may occur only once.<br />
Note: If the database is configured to use the Single Sign On (SSO) and the <strong>Teradata</strong> client<br />
machine is logged on, the machine name, user name, and password are not required in the<br />
LOGON command. The user name and password combination specified when the <strong>Teradata</strong><br />
client machine was logged on are authenticated via network security for a SSO such that valid<br />
<strong>Teradata</strong> users will be permitted to log on to <strong>Teradata</strong> <strong>Data</strong>base. The use of SSO is strictly<br />
optional, unless the Gateway has been configured to accept only SSO-style logons.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 169
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LOGON<br />
To connect to a <strong>Teradata</strong> <strong>Data</strong>base other than the default, the TDPid must be included in the<br />
LOGON command. If the TDPid is not specified, the default contained in clispb.dat will be<br />
used. To be interpreted correctly, the TDPid must be followed by the slash separator (/), to<br />
distinguish the TDPid from a <strong>Teradata</strong> <strong>Data</strong>base user name. For example, to connect to<br />
slugger, enter one of the following:<br />
.LOGON slugger/;<br />
.LOGON slugger/,,'acctinfo';<br />
If the LOGON command is entered first, <strong>Teradata</strong> T<strong>Pump</strong> warns that the LOGTABLE<br />
command is also required.<br />
If an account ID is to be used, the optional account ID must be specified in the LOGON<br />
command.<br />
170 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LOGTABLE<br />
LOGTABLE<br />
Purpose<br />
Caution:<br />
The LOGTABLE command identifies the table to be used for journaling checkpoint<br />
information required for safe, automatic restart of the <strong>Teradata</strong> T<strong>Pump</strong> support environment<br />
in the event of a client or <strong>Teradata</strong> <strong>Data</strong>base hardware platform failure.<br />
The LOGTABLE command is used in conjunction with the LOGON command, both of which<br />
are required. Both LOGON and LOGTABLE may appear in any order. The ACCEPT and SET<br />
commands are valid commands preceding LOGON and LOGTABLE commands. If LOGON is<br />
entered first, a warning is returned that the LOGTABLE is required.<br />
Do not share the restart log table between two or more <strong>Teradata</strong> T<strong>Pump</strong> jobs. Each <strong>Teradata</strong><br />
T<strong>Pump</strong> job must have its own restart log table to ensure that it runs correctly. If a distinct<br />
restart log table for each <strong>Teradata</strong> T<strong>Pump</strong> job is not used, the results are unexpected. In<br />
addition, one or more of the affected jobs may not be able to restart.<br />
Syntax<br />
.LOGTABLE<br />
dbname.<br />
tname<br />
;<br />
3021A029<br />
where<br />
Syntax Element<br />
dbname<br />
tname<br />
Description<br />
(Optional) <strong>Data</strong>base name under which the log table exists<br />
The default is the database name associated with the username specified in the<br />
LOGON command. <strong>Teradata</strong> T<strong>Pump</strong> searches for the table (tname) in that<br />
database unless another database name is specified in this option.<br />
Identifier for the restart log table<br />
Usage Notes<br />
A LOGTABLE command is required for each invocation of <strong>Teradata</strong> T<strong>Pump</strong>. Only a single<br />
LOGTABLE command is allowed for each execution. It must precede all environmental and<br />
application commands (other than RUN FILE and LOGON) in the input stream.<br />
The specified table is used as the <strong>Teradata</strong> T<strong>Pump</strong> restart log. It does not have to be fully<br />
qualified. If the table exists, it is examined to determine if this is a restart. When this is the<br />
case, a restart is done automatically. If the table does not exist, it is created and used as a restart<br />
log during this invocation of <strong>Teradata</strong> T<strong>Pump</strong>.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 171
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
LOGTABLE<br />
The log table is maintained automatically by <strong>Teradata</strong> T<strong>Pump</strong>. If this table is manipulated in<br />
any way, the restart capability is lost. The only action that should be taken is to DROP the log<br />
table; never attempt to delete rows from the table. The log table should not be dropped when<br />
the <strong>Teradata</strong> T<strong>Pump</strong> job using that log table is running. If the log table is dropped during a job<br />
run, <strong>Teradata</strong> T<strong>Pump</strong> will run into errors.<br />
The default for the database name cannot be overridden with a DATABASE statement because<br />
it must come after LOGTABLE/ LOGON. Instead, the LOGTABLE dbname option must be<br />
used.<br />
<strong>Teradata</strong> T<strong>Pump</strong> allows a DELETE DATABASE statement because DELETE is a standard<br />
<strong>Teradata</strong> SQL function. This statement can delete the current restart log after it has been<br />
created, which terminates the job.<br />
Example<br />
The following example presents both the LOGTABLE command and the LOGON command<br />
as they typically occur.<br />
.logtable Mine.Logtable001;<br />
.logon tdpx/me,paswd;<br />
Log Table Space Requirements<br />
The calculation of space requirements for a <strong>Teradata</strong> T<strong>Pump</strong> log table is highly dependent on<br />
the specifics of the job. Although there are mandatory inserts for every <strong>Teradata</strong> T<strong>Pump</strong> job,<br />
others occur on a job-dependent basis. See “Estimating Space Requirements” for details on<br />
how to calculate log table space.<br />
172 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
NAME<br />
NAME<br />
Purpose<br />
The NAME command assigns a unique job name identifier to the environmental variable<br />
&SYSJOBNAME.<br />
Syntax<br />
.NAME jobname<br />
;<br />
3021A030<br />
where<br />
Syntax Element<br />
jobname<br />
Description<br />
Character string that identifies the name of a job in a maximum of<br />
16 characters<br />
If this command is not specified, the default job name of ltdbase_logtable is<br />
used, where:<br />
• ltdbase is a character string of up to the first seven characters of the name of<br />
the database containing the log table.<br />
• logtable is a character string with the first eight characters of the log table<br />
name.<br />
Usage Notes<br />
The NAME environmental command must be used only once, in order to set the job name<br />
and the variable &SYSJOBNAME. Further attempts to execute the command will fail.<br />
The NAME command sets the variable &SYSJOBNAME to the specified string. The string is<br />
truncated to 16 characters. It is an error to use this command more than once in a <strong>Teradata</strong><br />
T<strong>Pump</strong> script or after the first BEGIN LOAD command in the script.<br />
If &SYSJOBNAME is not set using the NAME command, it defaults to<br />
MYYYYMMDD_HHMMSS_LLLLL, where<br />
M = macro<br />
MM = month<br />
DD = day<br />
YYYY = year<br />
hh = hour<br />
mm = minute<br />
ss = second<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 173
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
NAME<br />
lllll = is the low order 5 digits of the logon sequence number returned by the database from the<br />
.LOGON command.<br />
This variable is not set until created with the NAME command, or with the first BEGIN LOAD<br />
by default. Any attempt to use it before a NAME command is issued (or before the first<br />
BEGIN LOAD if there is no NAME command), results in a syntax error. This variable is<br />
significant because it is used by <strong>Teradata</strong> T<strong>Pump</strong> when composing default names for various<br />
database artifacts, namely the error table and <strong>Teradata</strong> T<strong>Pump</strong>-created macros.<br />
Note: If serialization for two or more DML statements is required, they cannot be put in<br />
different partitions. Serialization requires that all DML statements with identical hash values<br />
of the rows be submitted from the same session.<br />
174 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
PARTITION<br />
PARTITION<br />
Purpose<br />
The PARTITION command defines a collection of sessions used to transfer SQL requests to<br />
<strong>Teradata</strong> <strong>Data</strong>base. A DML command may name the partition to be used for its requests to<br />
the database.<br />
A default session partition may still be created using the SESSIONS and PACK parameters of<br />
the BEGIN LOAD command.<br />
This command works in conjunction with a DML parameter, PARTITION, which names the<br />
session partition that a DML’s SQL will use. If the DML command does not have a<br />
PARTITION parameter, then the default partition created using the SESSIONS and PACK<br />
parameters of the BEGIN LOAD command will be used.<br />
Syntax<br />
.PARTITION partition_name SESSIONS number A<br />
threshold<br />
A<br />
DATAENCRYPTION<br />
PACK<br />
PACKMAXIMUM<br />
statements<br />
OFF<br />
ON<br />
3021B018<br />
where<br />
Syntax Element<br />
number<br />
Description<br />
Number of sessions to be logged on for the partition<br />
<strong>Teradata</strong> T<strong>Pump</strong> logs on and uses the number of sessions specified to<br />
communicate requests to <strong>Teradata</strong> <strong>Data</strong>base.<br />
There is no default value for number; it must be specified. Neither is there a<br />
maximum value, except for system-wide session limitations, which vary<br />
among machines.<br />
Limiting the number of sessions conserves resources on both the external<br />
system and <strong>Teradata</strong> <strong>Data</strong>base. This conservation is at the expense of a<br />
potential decrease in throughput and increase in elapsed time.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 175
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
PARTITION<br />
Syntax Element<br />
DATAENCRYPTION<br />
ON/OFF<br />
PACK<br />
PACKMAXIMUM<br />
partition_name<br />
SESSIONS<br />
Description<br />
Keyword to encrypt import data and the request text during the<br />
communication between <strong>Teradata</strong> T<strong>Pump</strong> and <strong>Teradata</strong> <strong>Data</strong>base for the<br />
sessions defined in the PARTITION command<br />
If ON, the encryption will be performed. If OFF, the encryption will not be<br />
performed. If DATAENCRYPTION is not specified, the default is OFF<br />
when "-y" runtime parameter is not specified and DATAENCRYPTION is<br />
OFF in the BEGIN LOAD command. If "-y" runtime parameter is specified<br />
or DATAENCRYPTION is ON in the BEGIN LOAD command, the default<br />
is ON.<br />
This option applies to the sessions defined by the PARTITION command.<br />
When the session is specified explicitly, the setting overrides the encryption<br />
setting by the "-y" runtime parameter and by the DATAENCRYPTION<br />
option in the BEGIN LOAD command for the sessions defined in the<br />
PARTITION command.<br />
Keyword for the number of statements to pack into a multiple-statement<br />
request<br />
Maximum value is 2430.<br />
Packing improves network/channel efficiency by reducing the number of<br />
sends and receives between the application and <strong>Teradata</strong> <strong>Data</strong>base.<br />
Keyword requesting <strong>Teradata</strong> T<strong>Pump</strong> to dynamically determine the<br />
maximum possible PACK factor for the current partition<br />
Maximum value is 2430.<br />
Displayed in message UTY6652, the value thus determined should be<br />
specifically used on subsequent runs, as the use of PACKMAXIMUM<br />
requires iterative interactions with the database during initialization to<br />
heuristically determine the maximum possible PACK factor.<br />
Name assigned to the partition for reference by one or more subsequent<br />
DML commands<br />
A partition name must obey the same rules for its construction as <strong>Teradata</strong><br />
SQL column names. The name specified may be used in the PARTITION<br />
clause of a DML command.<br />
Keyword for designating the number of sessions for the partition<br />
176 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
PARTITION<br />
Syntax Element<br />
statements<br />
threshold<br />
Description<br />
Number of statements, as a positive integer of up to 2430, to pack into a<br />
multiple-statement request<br />
Default value is 20 statements per request.<br />
Note: Under certain conditions, <strong>Teradata</strong> T<strong>Pump</strong> may determine that the<br />
pack factor has been set too high. <strong>Teradata</strong> T<strong>Pump</strong> then automatically<br />
lowers the pack setting to an appropriate value and issues warning message<br />
UTY6625, for example:<br />
“UTY6625 WARNING: Packing has been changed to 12 statements per<br />
request”, and continues.<br />
Packing improves network/channel efficiency by reducing the number of<br />
sends/receives between the application and the database.<br />
The packing factor is validated by sending a fully packed request to<br />
<strong>Teradata</strong> <strong>Data</strong>base using a prepare. This test checks for syntax problems<br />
and requests that are excessively large and overwhelm the parser.<br />
To simplify the script development process, <strong>Teradata</strong> T<strong>Pump</strong> ignores<br />
certain errors returned by an overloaded parser, shrinks the request, retries<br />
the prepare until it executes successfully and finally, issues a warning noting<br />
the revised packing factor size.<br />
When this happens, the <strong>Teradata</strong> T<strong>Pump</strong> script should be modified to<br />
eliminate the warning, which avoids the time-consuming process of<br />
shrinking the request.<br />
Note: A packing failure may occur if the source parcel length does not<br />
match the data defined. If this happens, <strong>Teradata</strong> T<strong>Pump</strong> issues the<br />
message:<br />
“UTY2819 WARNING: Packing may fail because input data does not<br />
match with the data defined.”<br />
To resolve this problem, increase the packing factor and resubmit the job.<br />
Minimum number of sessions to be logged on for the partition<br />
When logging on sessions, if system limits are reached above the threshold<br />
value, <strong>Teradata</strong> T<strong>Pump</strong> stops trying to log on, and uses whatever sessions<br />
are already logged on.<br />
If the sessions run out before the threshold is reached, <strong>Teradata</strong> T<strong>Pump</strong><br />
logs off all sessions, waits for the time determined by the SLEEP value<br />
(specified in the BEGIN LOAD command), and tries to log on again.<br />
Example<br />
A sample script that uses partitioning follows:<br />
.LOGTABLE TPLOG01;<br />
.LOGON cs4400s3/cfl,cfl;<br />
DROP TABLE TPTBL01;<br />
DROP TABLE TPTBL02;<br />
DROP TABLE TPERR01;<br />
CREATE TABLE TPTBL01, FALLBACK(<br />
C1 CHAR(12) not null,<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 177
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
PARTITION<br />
C2 CHAR(8) not null)<br />
PRIMARY INDEX (C1);<br />
CREATE TABLE TPTBL02, FALLBACK(<br />
C1 CHAR(12),<br />
C2 CHAR(8),<br />
C3 CHAR(6))<br />
UNIQUE PRIMARY INDEX (C1);<br />
.BEGIN LOAD<br />
ERRLIMIT 100 50<br />
CHECKPOINT 15<br />
TENACITY 2<br />
ERRORTABLE TPERR01<br />
ROBUST off<br />
serialize on<br />
;<br />
.LAYOUT LAY02;<br />
.FIELD cc1 * CHAR(12) key;<br />
.FIELD cc2 * CHAR(8);<br />
.FIELD cc3 * CHAR(6);<br />
.filler space1 * char(1);<br />
.partition part1 pack 10 sessions 10;<br />
.partition part2 sessions 5 1 packmaximum;<br />
.DML LABEL LABEL01 partition part1<br />
DO INSERT FOR MISSING ROWS<br />
ignore extra update rows<br />
use(cc1, cc2);<br />
UPDATE TPTBL01<br />
SET C2 = :CC2<br />
WHERE C1 = :CC1;<br />
INSERT TPTBL01 (C1, C2)<br />
VALUES (:CC1,:CC2);<br />
.DML LABEL LABEL02 partition part2<br />
serializeon( cc1 )<br />
ignore extra update rows<br />
DO INSERT FOR MISSING UPDATE ROWS;<br />
UPDATE TPTBL02 SET C2 = :CC2 WHERE C1 = :CC1;<br />
INSERT TPTBL02 (C1, C2, C3)<br />
VALUES (:CC1,:CC2,:CC3);<br />
.IMPORT INFILE c:\NCR\Test\Tpump<strong>Data</strong>001.txt FORMAT TEXT<br />
LAYOUT LAY02<br />
APPLY LABEL01<br />
APPLY LABEL02 where CC2 = '00000001';<br />
.END LOAD;<br />
.LOGOFF;<br />
178 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
ROUTE<br />
ROUTE<br />
Purpose<br />
The ROUTE command identifies the destination of various outputs produced by <strong>Teradata</strong><br />
T<strong>Pump</strong>.<br />
Syntax<br />
.ROUTE<br />
MESSAGES<br />
FILE fileid1<br />
TO<br />
ECHO FILE fileid2<br />
WITH<br />
TO<br />
ECHO OFF<br />
WITH<br />
FILE fileid1<br />
ECHO fileid2<br />
TO<br />
WITH<br />
TO<br />
FILE fileid1<br />
ECHO OFF<br />
TO<br />
WITH<br />
;<br />
3021A031<br />
where<br />
Syntax Element<br />
MESSAGES<br />
fileid1 and fileid2<br />
ECHO<br />
Description<br />
Preferred location where the messages be redirected (normally written to<br />
DDNAME SYSPRINT in z/OS or stdout in UNIX); that is, sent to an<br />
additional destination, or both<br />
Alternate message destination in the external system<br />
UNIX and Windows<br />
Fileid is the path name for a file. If the path name has embedded white<br />
space characters, enclose the entire path name in single or double quotes.<br />
z/OS<br />
A DDNAME. See the z/OS fileid topic in the “Usage Notes” section.<br />
Additional destination, with a fileid specification<br />
Use the ECHO keyword to specify, for example, that messages be captured<br />
in a file (fileid2) while still being written to the terminal.<br />
Note: The ECHO OFF specification cancels the additional file<br />
specification of a previously established ECHO destination.<br />
Usage Notes<br />
In z/OS, fileid is a true DDNAME; and in UNIX, it is a file pathname. If DDNAME is specified,<br />
<strong>Teradata</strong> T<strong>Pump</strong> writes data records to the specified destination. A DDNAME must obey the<br />
same rules for its construction as <strong>Teradata</strong> SQL column names except that the “at” sign (@) is<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 179
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
ROUTE<br />
Example 1<br />
allowed as an alphabetic character and the underscore ( _ ) is not allowed. The DDNAME<br />
must also obey the applicable rules of the external system. If DDNAME represents a data<br />
source on magnetic tape, the tape may be either labelled or nonlabelled (if the operating<br />
system supports it).<br />
On UNIX systems, an asterisk (*) can be used as the fileid1 or fileid2 specifications to route<br />
messages to the system console/standard output (stdout) device. The system console is the:<br />
• Display screen in interactive mode<br />
or<br />
• Standard output device in batch mode<br />
.ROUTE MESSAGES TO FILE OUTPUT WITH ECHO TO FILE SYSOUT;<br />
ECHO, when specified with OFF, stops routing output to the previously established echo<br />
destination.<br />
Example 2<br />
.ROUTE MESSAGES FILE OUTPUT;<br />
The messages are written to the file designated by OUTPUT from this point unless redirected<br />
by another ROUTE command.<br />
In UNIX-based systems, if “outfilename” is used to redirect “stdout,” and also as the file in a<br />
ROUTE WITH ECHO command, the results written to “outfilename” may be incomplete due<br />
to conflicting writes to the same file.<br />
180 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
RUN FILE<br />
RUN FILE<br />
Purpose<br />
The RUN FILE command invokes the specified external source as the current source of<br />
commands and statements.<br />
Syntax<br />
.RUN FILE<br />
fileid<br />
IGNORE<br />
charpos1<br />
charpos1 THRU<br />
THRU charpos2<br />
charpos1 THRU charpos2<br />
;<br />
3021A032<br />
where<br />
Syntax Element<br />
fileid<br />
Description<br />
<strong>Data</strong> source of the external system<br />
The client system DD or equivalent statement specifies a file.<br />
UNIX and Windows<br />
infilename (the path name for a file). If the path name has embedded<br />
white space characters, enclose the entire path name in single or double<br />
quotes.<br />
z/OS<br />
a true DDNAME.<br />
If DDNAME is specified, <strong>Teradata</strong> T<strong>Pump</strong> reads data records from the<br />
specified source.<br />
A DDNAME must obey the same rules for its construction as <strong>Teradata</strong><br />
SQL column names, except that:<br />
• the “at” sign (@) is allowed as an alphabetic character<br />
• the underscore (_) is not allowed<br />
The DDNAME must also obey the applicable rules of the external system.<br />
If DDNAME represents a data source on magnetic tape, the tape may be<br />
either labelled or nonlabelled (if the operating system supports it). The<br />
“at” sign (@) is allowed as an alphabetic character and the underscore (_)<br />
is not allowed.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 181
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
RUN FILE<br />
Syntax Element<br />
charpos1 and charpos2<br />
Description<br />
Start and end character positions of a field in each input record which<br />
contains extraneous information<br />
<strong>Teradata</strong> T<strong>Pump</strong> ignores the specified field(s) as follows:<br />
• charpos1: only the single specified character position is ignored.<br />
• charpos1 THRU: character positions from charpos1 through the end of<br />
the record are ignored.<br />
• THRU charpos2: character positions from the beginning of the record<br />
through charpos2 are ignored.<br />
• charpos1 THRU charpos2: character positions from charpos1 through<br />
charpos2 are ignored.<br />
Usage Notes<br />
Once <strong>Teradata</strong> T<strong>Pump</strong> executes the RUN FILE command, further commands and DML<br />
statements are read from the specified source until a LOGOFF command or end-of-file<br />
condition is encountered, whichever occurs first. An end-of-file condition automatically<br />
causes <strong>Teradata</strong> T<strong>Pump</strong> to resume reading its commands and DML statements from the<br />
previously active source (or the previous RUN source when RUNs are nested), either SYSIN<br />
for z/OS, or stdin (normal or redirected) in UNIX. After SYSIN/stdin processes any userprovided<br />
invocation parameter, it remains the active input source.<br />
If an end-of-file condition occurs on fileid, SYSIN/stdin is read because there are no more<br />
commands or statements in the PARM string.<br />
The command source specified by a RUN FILE command may contain nested RUN FILE<br />
commands to 16 levels.<br />
On UNIX systems, an asterisk (*) can be used as the fileid specification for the system console/<br />
standard input (stdin) device. The system console is the:<br />
• Keyboard in interactive mode<br />
or<br />
• Standard input device in batch mode<br />
Example<br />
.RUN FILE LOGON;<br />
182 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
SET<br />
SET<br />
Purpose<br />
The SET command assigns a data type and a value to a utility variable. Variables need not be<br />
declared in advance to be the object of the SET command. If a variable does not already exist,<br />
the SET command creates it.<br />
The SET command also dynamically changes the data type to that of the assigned value if it<br />
has already been defined. Variables used to the right of TO in the expression must have already<br />
been defined.<br />
Syntax<br />
.SET<br />
var<br />
TO<br />
expression<br />
;<br />
3021A033<br />
where<br />
Syntax Element<br />
var<br />
expression<br />
Description<br />
Name of the utility variable which is set to the evaluated expression<br />
following it<br />
Value and data type to which the utility variable is to be set<br />
Usage Notes<br />
The utility variable can be substituted wherever substitution is allowed.<br />
If the expression evaluates to a numeric value, the symbol is assigned an integer value, as in:<br />
.SET FOONUM TO -151 ;<br />
If the expression is a quoted string, the symbol is assigned a string value, as in:<br />
.SET FOOCHAR TO '-151' ;<br />
The minimum and maximum limits for Floating Point data types are as follows:<br />
4.0E-75
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
SET<br />
Example 2<br />
In this example, X evaluates to 12. If a decimal point is added to the concatenated variables, as<br />
in:<br />
.SET C TO 1;<br />
.SET D TO 2;<br />
.SET X TO &C..&D;<br />
X then evaluates to 1.2.<br />
184 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
SYSTEM<br />
SYSTEM<br />
Purpose<br />
The SYSTEM command allows access to the local operating system during <strong>Teradata</strong> T<strong>Pump</strong><br />
operations.<br />
Syntax<br />
.SYSTEM 'oscommand'<br />
;<br />
3021A034<br />
where<br />
Syntax Element<br />
‘oscommand'<br />
Description<br />
Command string (enclosed within single quotes) that is appropriate to the local<br />
operating system<br />
The SYSTEM command suspends the current <strong>Teradata</strong> T<strong>Pump</strong> application in<br />
order to execute the command. When the command completes, the return code<br />
from the invoked command is displayed, and the &SYSRC variable is updated<br />
with the return code.<br />
Usage Notes<br />
On z/OS clients, the command is passed to the PGM executor. The first token of the command<br />
string is interpreted as a load module and the remainder as a PARM string. As an example, the<br />
following statement calls the load module IEBUPDTE, passing the PARM string “NEW”.<br />
.SYSTEM “IEBUPDTE NEW”;<br />
This command calls IEBUPDTE in the same way it is called via the JCL statement:<br />
//EXEC PGM=IEBUPDTE,PARM='NEW'<br />
On z/OS, the program must be present in the STEPLIB or JOBLIB concatenation, be resident<br />
in one of the LPAs, or be located in the linklist concatenation.<br />
Otherwise, the invocation will fail, with code SYS_ABTM (-14) returned, resulting from an<br />
underlying abend S806-04. Other types of failures also are possible.<br />
On UNIX clients, the SYSTEM command invokes the standard UNIX interface to issue the<br />
command to the shell (sh), and waits for its completion.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 185
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
TABLE<br />
TABLE<br />
Purpose<br />
The TABLE command identifies a table whose column names and data descriptions are used<br />
as the names and data descriptions of the input record fields. These are assigned in the order<br />
defined. The TABLE command must be used with the LAYOUT command.<br />
Syntax<br />
.TABLE<br />
tableref<br />
;<br />
3021A035<br />
where<br />
Syntax Element<br />
tableref<br />
Description<br />
Existing table whose column names and data descriptions are assigned, in the<br />
order defined, to fields of the input data records<br />
The column names of the table specified by the TABLE command must be<br />
<strong>Teradata</strong> SQL column names that do not require being enclosed in quotation<br />
marks. Tables cannot be created with invalid column names. Any nonstandard<br />
column name causes one of three kinds of errors, depending on the nature of<br />
the divergence from the standard. These errors are:<br />
• Embedded blanks cause a syntax error, depending on the non-blank<br />
contents of the name.<br />
• Invalid characters cause an invalid name error.<br />
• Reserved words cause a syntax error that mentions invalid use of the<br />
reserved word.<br />
Usage Notes<br />
One or more TABLE commands may be intermixed with the FIELD command or FILLER<br />
command following a LAYOUT command.<br />
This method of specifying record layout fields assumes each field, as defined by the data<br />
description of the corresponding column of tableref, is contiguous with the previous one,<br />
beginning at the next available character position beyond any previous field specifications for<br />
the input records. The fields must appear in the order defined for the columns of the table.<br />
The object identified by the tableref parameter must be a table. It need not appear as a<br />
parameter of the BEGIN LOAD command, but the user must either be an owner of the object<br />
or have at least one privilege on it. If specified as an unqualified table name, the current<br />
default database qualifies it.<br />
186 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
TABLE<br />
When serialization has been set to ON by the BEGIN LOAD command, the primary index<br />
columns for the specified table are considered key fields for serialization purposes.<br />
When the TABLE command is used and the table contains a structured UDT type, <strong>Teradata</strong><br />
T<strong>Pump</strong> returns an external representation of the UDT and that requires the user to transform.<br />
The term “external type” means the data type of the external opaque container for a<br />
structured UDT and is the type returned by the from-sql transform method.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 187
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
UPDATE Statement and Atomic Upsert<br />
UPDATE Statement and Atomic Upsert<br />
Purpose<br />
<strong>Teradata</strong> T<strong>Pump</strong> supports the UPDATE <strong>Teradata</strong> SQL statement, which changes field values in<br />
existing rows of a table.<br />
Syntax<br />
where<br />
,<br />
UPDATE tname SET cname = expr WHERE conditional ;<br />
UPD<br />
3021A036<br />
Syntax Element<br />
tname<br />
cname<br />
expr<br />
WHERE condition<br />
Description<br />
Table or view to be updated<br />
This table was previously identified as tname in the BEGIN LOAD command.<br />
If tname is not explicitly qualified by database name, the current default<br />
database qualifies it.<br />
Column whose value is to be replaced by the value of expr<br />
The column named must not be a column of the primary index.<br />
Expression whose resulting value is to replace the current value of the<br />
identified column<br />
The expression can contain any combination of constants, current values of<br />
columns of the referenced row, or values from fields of input data records.<br />
References to fields of input data records are as follows:<br />
:fieldname<br />
where :fieldname is defined by a FIELD command or TABLE command of the<br />
layout referenced by an IMPORT using this UPDATE.<br />
Conditional clause specifying the row or rows to be updated<br />
The conditional clause can use values from fields of input data records by<br />
referring to their field names as follows:<br />
:fieldname<br />
where fieldname is defined by a FIELD command or TABLE command.<br />
Equality values for all the columns of the primary index must be explicitly<br />
specified in this clause.<br />
188 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
UPDATE Statement and Atomic Upsert<br />
Usage Notes - Update<br />
Temporal Semantics<br />
The following notes describe how to use an UPDATE statement following a DML command.<br />
An UPDATE statement may also be used in the support environment; normal rules for<br />
UPDATE are followed in that case.<br />
• To update records in a table, the userid that is logged on must have UPDATE privilege for<br />
the table.<br />
• In an IMPORT task, if multiple Unique Primary Index (UPI) columns are specified, the<br />
columns should all be specified in the WHERE clause of the UPDATE statement. In this<br />
case, the WHERE clause is fully qualified, thereby allowing <strong>Teradata</strong> T<strong>Pump</strong> to avoid table<br />
locks and optimize the processing.<br />
• For <strong>Teradata</strong> T<strong>Pump</strong> use, if the object of the UPDATE statement is a view, it must not<br />
specify a join. <strong>Teradata</strong> T<strong>Pump</strong> operates only on single table statements so UPDATE<br />
statements must not contain any joins.<br />
• Only one object may be identified.<br />
• The OR construct can be used in the WHERE clause of a DELETE statement; alternatively,<br />
two or more separate DML statements (one per OR term) can be used, with the DML<br />
statements applied conditionally with the APPLY clause of the IMPORT command. The<br />
nature of the alternatives will usually make one of the methods more appropriate.<br />
• The maximum number of INSERT, UPDATE, and DELETE statements that can be<br />
referenced in an IMPORT is 128. The 128th DML which would cause the insertion of the<br />
DML sequence number of 128 for the DMLSEQ field in the error table could lead to<br />
<strong>Teradata</strong> <strong>Data</strong>base 3520 error.<br />
• The maximum number of DML statements that can be packed into a request is 2430 . The<br />
default number of statements packed is 20.<br />
• To ensure data integrity, the SERIALIZE parameter defaults to ON in the absence of an<br />
explicit value if there are upserts in the <strong>Teradata</strong> T<strong>Pump</strong> job.<br />
DML validtime qualifier and NONTEMPORAL semantics are supported. For more<br />
information, see SQL <strong>Data</strong> Manipulation Language and SQL <strong>Data</strong> Manipulation Language<br />
Advanced Topics.<br />
Example<br />
The following example describes an input data source containing a series of 14-byte records.<br />
Each record contains the value of the primary index column (EmpNo) of a row of the<br />
Employee table whose PhoneNo column is to be assigned a new phone number from field<br />
Fone.<br />
.BEGIN LOAD SESSION number;<br />
.LAYOUT Layoutname;<br />
.FIELD EmpNum 1 INTEGER;<br />
.FIELD Fone * (CHAR (10));<br />
.DML LABEL DMLlabelname;<br />
UPDATE Employee SET PhoneNo = :Fone WHERE EmpNo = :EmpNum;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 189
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
UPDATE Statement and Atomic Upsert<br />
.IMPORT INFILE Infilename LAYOUT Layoutname APPLY DMLlabelname;<br />
.END LOAD;<br />
Usage Notes - Atomic Upsert<br />
The syntax for Atomic upsert consists of an UPDATE statement and an INSERT statement<br />
separated by an ELSE keyword as follows:<br />
UPDATE ELSE INSERT ;<br />
<strong>Teradata</strong> T<strong>Pump</strong> inserts the ELSE keyword between the UPDATE and INSERT statements by<br />
itself, so the user should not enter it in the script. If the ELSE keyword is used in this context,<br />
<strong>Teradata</strong> T<strong>Pump</strong> will terminate with a syntax error.<br />
The and are operands for regular UPDATE and<br />
INSERT SQL statements, respectively. Only certain types of UPDATE and INSERT operands<br />
are valid in an Atomic upsert statement, and the operand parameters within a given upsert<br />
statement are subject to further constraints linking the update and insert parameters.<br />
When using the standard upsert feature, the primary index should always be fully specified for<br />
the UPDATE statement, just as for other DML in a <strong>Teradata</strong> T<strong>Pump</strong> script, so that the update<br />
can be processed as a one-AMP rather than an all-AMP operation. In addition, both the<br />
UPDATE and the INSERT of an upsert statement pair should specify the same target table,<br />
and the primary index value specified in the UPDATE's WHERE clause should match the<br />
primary index value implied by the column values in the INSERT. When processing an<br />
Atomic upsert statement, <strong>Teradata</strong> <strong>Data</strong>base will usually reject statements that fail to meet<br />
these basic upsert constraints and return an error, enabling <strong>Teradata</strong> T<strong>Pump</strong> to detect and<br />
handle constraint violations.<br />
Constraints considered to be basic to the upsert operation are:<br />
• SAME TABLE: The UPDATE and INSERT statements must specify the same table.<br />
• SAME ROW: The UPDATE and INSERT statements must specify the same row; that is, the<br />
primary index value in the inserted row must be the same as the primary value in the<br />
targeted UPDATE row.<br />
• HASHED ROW ACCESS: The UPDATE must fully specify the primary index, allowing the<br />
target row to be accessed with a one-AMP hashed operation.<br />
• Some of these restrictions concern syntax that is supported in UPDATE and INSERT<br />
statements separately but not when combined in an Atomic upsert statement. Restrictions<br />
not supported by the Atomic upsert feature that return an error if submitted to <strong>Teradata</strong><br />
<strong>Data</strong>base are:<br />
• INSERT... SELECT: Syntax not supported. The INSERT may not use a subquery to specify<br />
any of the inserted values. Note that support of this syntax is likely to be linked to support<br />
of subqueries in the UPDATE's WHERE clause constraints as described above, and may<br />
involve new syntax features to allow the UPDATE and INSERT to effectively reference the<br />
same subquery.<br />
• UPDATE-WHERE-CURRENT: Syntax not supported. The WHERE clause cannot use an<br />
updatable cursor to do what is called a positioned UPDATE. (It is unlikely that this syntax<br />
will ever be supported.) Note that this restriction does not prevent cursors from being<br />
190 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
UPDATE Statement and Atomic Upsert<br />
used in other ways with Atomic upsert statements. For example, a DECLARE CURSOR<br />
statement may include upsert statements among those to be executed when the cursor is<br />
opened, as long as the upserts are otherwise valid.<br />
• UPDATE-FROM: Not supported. The SET clause cannot use a FROM clause table<br />
reference in the expression for the updated value for a column.<br />
• UPDATE-WHERE SUBQUERIES: Not supported. The WHERE clause cannot use a<br />
subquery either to specify the primary index or to constrain a nonindex column. Note that<br />
supporting this UPDATE syntax would also require support for either INSERT … SELECT<br />
or some other INSERT syntax feature that lets it specify the same primary index value as<br />
the UPDATE.<br />
• UPDATE-PRIMARY INDEX: Not supported. The UPDATE cannot change the primary<br />
index. This is sometime called unreasonable update.<br />
• TRIGGERS: Feature not supported if either the UPDATE or INSERT could cause a trigger<br />
to be fired. The restriction applies as if the UPDATE and INSERT were both executed,<br />
because the parser trigger logic will not attempt to account for their conditional execution.<br />
UPDATE triggers on columns not referenced by the UPDATE clause, however, will never<br />
be fired by the upsert and are therefore permitted. DELETE triggers cannot be fired at all<br />
by an upsert and are likewise permitted. Note that an upsert could be used as a trigger<br />
action but it would be subject to the same constraints as any other upsert. Because upsert<br />
is not allowed to fire any triggers itself, an upsert trigger action must not generate any<br />
further cascaded trigger actions.<br />
• JOIN/HASH INDEXES: Feature not supported if either the UPDATE or INSERT could<br />
cause the join/hash index to be updated. As with triggers, the restriction applies to each<br />
upsert as if the UPDATE and INSERT were both executed. While the UPDATE could<br />
escape this restriction if the join/hash index does not reference any of the updated<br />
columns, it is much less likely (and maybe impossible) for the INSERT to escape this<br />
restriction. If the benefit of lifting the restriction for a few unlikely join/hash index cases<br />
turns out to be not worth the implementation cost, the restriction may have to be applied<br />
more broadly to any table with an associated join/hash index.<br />
<strong>Teradata</strong> T<strong>Pump</strong> treats a failed constraint as a nonfatal error, reports the error in the job log<br />
for diagnostic purposes, and continues with the job by reverting to nonbasic upsert protocol.<br />
To resolve order-dependency issues, <strong>Teradata</strong> T<strong>Pump</strong> always processes the UPDATE before the<br />
INSERT because:<br />
• It matches the ordering implied by the upsert name: UP[date] + [in]SERT.<br />
• It matches the ordering implied by the UPDATE-ELSE-INSERT syntax.<br />
• It matches the common definition of upsert semantics.<br />
• It allows for an upsert operation on MULTISET tables, where an insert-first policy would<br />
always succeed on INSERT and never on UPDATE.<br />
Existing <strong>Teradata</strong> T<strong>Pump</strong> scripts for upsert do not need to be changed. The syntax as<br />
described below for upsert will continue to be supported:<br />
DO INSERT FOR MISSING UPDATE ROWS;<br />
UPDATE ;<br />
INSERT ;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 191
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
UPDATE Statement and Atomic Upsert<br />
<strong>Teradata</strong> T<strong>Pump</strong> changes this syntax into Atomic upsert syntax by replacing the semicolon<br />
between the UPDATE and INSERT statements with an ELSE keyword to convert the statement<br />
pair into a single Atomic upsert statement.<br />
If user-created macros are used in place of the UPDATE and INSERT statements, <strong>Teradata</strong><br />
T<strong>Pump</strong> generates:<br />
EXEC ELSE EXEC ;<br />
because this statement does not conform to Atomic upsert syntax used by <strong>Teradata</strong> T<strong>Pump</strong>.<br />
Atomic Upsert Examples<br />
This section describes several examples that demonstrate how the Atomic upsert feature<br />
works, including cases where errors are detected and returned to the user. All of the examples<br />
use the same table, called Sales, as shown below:<br />
CREATE TABLE Sales, FALLBACK,<br />
(ItemNbrINTEGER NOT NULL,<br />
SaleDateDATE FORMAT 'MM/DD/YYYY' NOT NULL,<br />
ItemCountINTEGER)<br />
PRIMARY INDEX (ItemNbr);<br />
Assume that the table has been populated with the following data:<br />
INSERT INTO Sales (10, '05/30/2005', 1);<br />
A table called NewSales has the same column definitions as those of table Sales.<br />
Example 1 (Error: different target tables)<br />
This example demonstrates an upsert statement that does not specify the same table name for<br />
the UPDATE part and the INSERT part of the statement.<br />
UPDATE Sales SET ItemCount = ItemCount + 1 WHERE (ItemNbr = 10 AND<br />
SaleDate = '05/30/2005') ELSE INSERT INTO NewSales (10, '05/30/2005',<br />
1);<br />
A rule of an upsert is that only one single table is processed for the statement. Because the<br />
tables, Sales and NewSales, are not the same for the upsert statement, an error is returned to<br />
the user indicating that the name of the table must be the same for both the UPDATE and the<br />
INSERT.<br />
Example 2 (Error: different target rows)<br />
This example demonstrates an upsert statement that does not specify the same primary index<br />
value for both the UPDATE and INSERT parts of the statement.<br />
UPDATE Sales SET ItemCount = Itemcount + 1 WHERE (ItemNbr = 10 AND<br />
SaleDate = '05/30/2005') ELSE INSERT INTO Sales (20, '05/30/2005', 1);<br />
The primary index values for the UPDATE and the INSERT must be the same. In this case, an<br />
error is returned to the user indicating that the primary index value must be the same for both<br />
the UPDATE and the INSERT.<br />
192 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
UPDATE Statement and Atomic Upsert<br />
Example 3 (Error: unqualified primary index)<br />
This example demonstrates an upsert statement that does not specify the primary index in the<br />
WHERE clause.<br />
UPDATE Sales SET ItemCount = ItemCount + 1 WHERE SaleDate = '05/30/2005'<br />
ELSE INSERT INTO Sales (10, '05/30/2005', 1);<br />
When the primary index is not fully specified in the UPDATE of an upsert statement, an allrow<br />
scan to find rows to update might result. This is again not the purpose of upsert, and an<br />
error is returned to the user.<br />
Example 4 (Error: missing ELSE)<br />
This example demonstrates an upsert statement with a missing ELSE keyword.<br />
UPDATE Sales SET ItemCount = ItemCount + 1 WHERE (ItemNbr = 10 AND<br />
SaleDate = '05/30/2005') INSERT INTO Sales (10, '05/30/2005', 1);<br />
Example 5 (Error: INSERT-SELECT)<br />
This example demonstrates an upsert statement that specifies INSERT … SELECT.<br />
UPDATE Sales SET ItemCount = ItemCount + 1 WHERE (ItemNbr = 10 AND<br />
SaleDate = '05/30/2005') ELSE INSERT INTO Sales SELECT * FROM NewSales<br />
WHERE (ItemNbr = 10 AND SaleDate = '05/30/2005');<br />
The INSERT part of an upsert may not use a subquery to specify any of the inserted values. In<br />
this case, a syntax error is returned.<br />
Example 6 (Error: UPDATE-FROM)<br />
This example demonstrates an upsert statement that specifies UPDATE-FROM.<br />
UPDATE Sales FROM NewSales SET Sales.ItemCount = NewSales.ItemCount<br />
WHERE Sales.ItemNbr = NewSales.ItemNbr ELSE INSERT INTO Sales (10, '05/<br />
30/2005', 1);<br />
The SET clause may not use a FROM clause table reference in the expression for the updated<br />
value for a column, and an error is returned.<br />
Example 7 (Error: UPDATE-WHERE SUBQUERIES)<br />
This example demonstrates an upsert statement that specifies UPDATE-WHERE<br />
SUBQUERIES.<br />
UPDATE Sales SET ItemCount = ItemCount + 1 WHERE ItemNbr IN (SELECT<br />
ItemNbr FROM NewSales) ELSE INSERT INTO Sales (10, '05/30/2005', 1);<br />
The WHERE clause of the UPDATE may not use a subquery for any purpose. In this case,<br />
error ERRTEQUPSCOM is returned.<br />
Example 8 (Error: UPDATE-PRIMARY INDEX)<br />
This example demonstrates an upsert statement that tries to update a primary index value.<br />
UPDATE Sales SET ItemNbr = 20 WHERE (ItemNbr = 10 AND SaleDate = '05/30/<br />
2005') ELSE INSERT INTO Sales (20, '05/30/2005', 1);<br />
Unreasonable updates or updates that change the primary index values are not allowed in an<br />
upsert statement, and an error is returned.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 193
Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />
UPDATE Statement and Atomic Upsert<br />
Example 9 (Valid Upsert UPDATE)<br />
This example demonstrates a successful upsert statement that updates a row.<br />
UPDATE Sales SET ItemCount = ItemCount + 1 WHERE (ItemNbr = 10 AND<br />
SaleDate = '05/30/2005') ELSE INSERT INTO Sales (10, '05/30/2005', 1);<br />
After all of the rules have been validated, the row with ItemNbr = 10 and SaleDate = '05/30/<br />
2005' gets updated. A successful update of one row results.<br />
Example 10 (Valid Upsert INSERT)<br />
This example demonstrates a successful upsert statement that inserts a row.<br />
UPDATE Sales SET ItemCount = ItemCount + 1 WHERE (ItemNbr = 20 AND<br />
SaleDate = '05/30/2005') ELSE INSERT INTO Sales (20, '05/30/2005', 1);<br />
After all of the rules have been validated and no row was found with Item = 20 and SaleDate =<br />
'05/30/2005' for the UPDATE, a new row is inserted with ItemNbr = 20. A successful insert of<br />
one row results.<br />
194 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
CHAPTER 4<br />
Troubleshooting<br />
This chapter provides a description of user aids for identifying and correcting errors that<br />
might occur during a <strong>Teradata</strong> T<strong>Pump</strong> task. Foremost among these tools are a large number of<br />
error messages. For more information on error messages, refer to Messages.<br />
Troubleshooting information in this chapter includes:<br />
• Early Error Detection<br />
• Error Types<br />
• Error Messages<br />
• Reading <strong>Teradata</strong> T<strong>Pump</strong> Error Tables<br />
• <strong>Teradata</strong> T<strong>Pump</strong> Performance Checklist<br />
Early Error Detection<br />
The <strong>Teradata</strong> T<strong>Pump</strong> utility avoids wasting time and resources on a task that contains<br />
terminating errors in either input statements, commands, or both. To accomplish this,<br />
statements and commands for a task are acquired and analyzed for detectable syntax and<br />
other errors before a <strong>Teradata</strong> T<strong>Pump</strong> task is initiated on <strong>Teradata</strong> <strong>Data</strong>base.<br />
When a BEGIN LOAD command invokes <strong>Teradata</strong> T<strong>Pump</strong>, and the utility can complete an<br />
error-free pass, it proceeds. If not, <strong>Teradata</strong> T<strong>Pump</strong> cleans up and terminates after an error<br />
pass. <strong>Teradata</strong> T<strong>Pump</strong> uses <strong>Teradata</strong> <strong>Data</strong>base to detect errors in the set of DML statements<br />
for the task. The first erroneous statement terminates <strong>Teradata</strong> T<strong>Pump</strong>.<br />
Error Types<br />
Most errors are fatal, resulting in termination of <strong>Teradata</strong> T<strong>Pump</strong>. The exceptions to this<br />
general rule are as follows:<br />
• User-specified SQL commands fail with no adverse effect. The variable &SYSRC is set, and<br />
if the script tests this variable it can stop the job if necessary.<br />
• <strong>Data</strong>-related errors in the database can reach the user-specified error limit before<br />
terminating the job. A list of data related errors is provided in Table 29.<br />
• Errors that can be retried. The error numbers for these types of errors are: 2595, 2631,<br />
2639, 2641, 2826, 2834, 2835, 3110, 3111, 3231, 3120, 3319, 3598, 3603, 5991, 6699, 8018,<br />
and 8024.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 195
Chapter 4: Troubleshooting<br />
Error Messages<br />
• When <strong>Teradata</strong> T<strong>Pump</strong> sends SQL statement to <strong>Teradata</strong> <strong>Data</strong>base in Prepare mode,<br />
<strong>Teradata</strong> T<strong>Pump</strong> treats warnings (messages sent back with SUCCESS parcels) as user<br />
errors and exits with error code 8.<br />
Error Messages<br />
<strong>Teradata</strong> <strong>Data</strong>base error message gpt errors that can be fixed and resubmitted are 2631, 2639,<br />
2641, 2834, 2835, 3110, 3111, 3120, 3127, 3178, 3598, 3603, and 8024.<br />
<strong>Teradata</strong> T<strong>Pump</strong> ignores errors on <strong>Teradata</strong> SQL statements outside of the <strong>Teradata</strong> T<strong>Pump</strong><br />
task; that is, before the BEGIN LOAD command or after the END LOAD command. The<br />
<strong>Teradata</strong> T<strong>Pump</strong> job continues and no return code is returned, although <strong>Teradata</strong> <strong>Data</strong>base<br />
error messages are displayed.<br />
When <strong>Teradata</strong> T<strong>Pump</strong> encounters errors caused by a <strong>Teradata</strong> <strong>Data</strong>base failure, it neither<br />
terminates the job nor produces a return code. When <strong>Teradata</strong> <strong>Data</strong>base recovers, <strong>Teradata</strong><br />
T<strong>Pump</strong> restarts the job and continues without user intervention. <strong>Teradata</strong> <strong>Data</strong>base failure<br />
messages are 2825, 2826, 2827, 2828, 3897, and 8018.<br />
When one of these errors occur, a row is inserted into <strong>Teradata</strong> T<strong>Pump</strong>’s error table for the<br />
statement or data record in question. If the error occurs for one of the statements in a<br />
multiple-statement request, the remaining statements are re-driven.<br />
The retryable errors are automatically retried up to 16 times if retry times are not specified.<br />
For the complete text and explanation of error messages, refer to Messages.<br />
A row is inserted into <strong>Teradata</strong> T<strong>Pump</strong>’s error table for the statement in error. If the error<br />
occurs for one of the statements in a multiple-statement request, then the remaining<br />
statements are re-driven. These errors include the conditions listed in Table 29.<br />
Table 29: <strong>Teradata</strong> T<strong>Pump</strong> Error Conditions<br />
Error<br />
Description<br />
2603 Bad argument for SQRT function.<br />
2604 Bad argument involving %TVMID.%FLDID for SQRT function.<br />
2605 Bad argument for LOG function.<br />
2606 Bad argument involving %TVMID.%FLDID for LOG function.<br />
2607 Bad argument for LN function.<br />
2608 Bad argument involving %TVMID.%FLDID for LN function.<br />
2614 Precision loss during expression evaluation.<br />
2615 Precision loss calculating expression involving %TVMID.%FLDID.<br />
2616 Numeric overflow occurred during computation.<br />
2617 Overflow occurred computing an expression involving %TVMID.%FLDID.<br />
196 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 4: Troubleshooting<br />
Error Messages<br />
Table 29: <strong>Teradata</strong> T<strong>Pump</strong> Error Conditions (continued)<br />
Error<br />
Description<br />
2618 Invalid calculation: division by zero.<br />
2619 Division by zero in an expression involving %TVMID.%FLDID.<br />
2620 The format or data contains a bad character.<br />
2621 Bad character in format or data of %TVMID.%FLDID.<br />
2622 Bad argument for ** operator.<br />
2623 Bad argument involving %TVMID.%FLDID for ** operator.<br />
2650 Numeric Processor Operand Error.<br />
2651 Operation Error computing expression involving %TVMID.%FLDID.<br />
2665 Invalid date.<br />
2666 Invalid date supplied for %TVMID.%FLDID.<br />
2674 Precision loss during data conversion.<br />
2675 Numerical overflow occurred during computation.<br />
2676 Invalid calculation: division by zero.<br />
2679 The format or data contains a bad character.<br />
2682 Precision loss during data conversion.<br />
2683 Numerical overflow occurred during computation.<br />
2684 Invalid calculation: division by zero.<br />
2687 The format or data contains a bad character.<br />
2689 Non-nullable field was null.<br />
2700 Referential constraint violation: invalid Foreign Key value.<br />
2726 Referential constraint violation: cannot delete/update the Parent Key value.<br />
2801 Duplicate unique prime key error in %DBID.%TVMID.<br />
2802 Duplicate row error in %DBID.%TVMID.<br />
2803 Secondary index uniqueness violation in %DBID.%TVMID.<br />
2805 Maximum row length exceeded in %TVMID.<br />
2814 <strong>Data</strong> size exceeds the maximum specified.<br />
2816 Failed to insert duplicate row into <strong>Teradata</strong> T<strong>Pump</strong> target table. This error occurs if MARK<br />
DUPLICATE INSERT/UPDATE ROWS is specified and a duplicate row is detected.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 197
Chapter 4: Troubleshooting<br />
Error Messages<br />
Table 29: <strong>Teradata</strong> T<strong>Pump</strong> Error Conditions (continued)<br />
Error<br />
Description<br />
2817 Activity count greater than one for <strong>Teradata</strong> T<strong>Pump</strong> UPDATE/DELETE. This error occurs<br />
if MARK EXTRA UPDATE/DELETE ROWS is specified and an activity count greater than<br />
one was seen. In this case, the error table row is inserted, but the corresponding UPDATE/<br />
DELETE also completes.<br />
2818 Activity count zero for <strong>Teradata</strong> T<strong>Pump</strong> UPDATE or DELETE. This error occurs if MARK<br />
MISSING UPDATE/DELETE ROWS is specified and an activity count of zero was seen.<br />
2844 Journal image is longer than maximum.<br />
2893 Right truncation of string data.<br />
3535 A character string failed conversion to a numeric value.<br />
3564 Range constraint: Check error in field%TVMID.%FLDID.<br />
3577 Row size overflow.<br />
3578 Scratch space overflow.<br />
3604 Cannot place a null value in a NOT NULL field.<br />
3751 Expected a digit for the exponent.<br />
3752 Too many digits in exponent.<br />
3753 Too many digits in integer or decimal.<br />
3754 Numeric precision error.<br />
3755 Numeric overflow error.<br />
3756 Numeric divided-by-zero error.<br />
3757 Numeric stack overflow error.<br />
3758 Numeric stack underflow error.<br />
3759 Numeric illegal character error.<br />
3996 Right truncation of string data.<br />
5317 Check constraint violation.<br />
5326 Operand of EXTRACT function is not a valid data type or value.<br />
5410 Invalid TIME literal.<br />
5411 Invalid TIMESTAMP literal.<br />
5991 Error during plan generation.<br />
6705 Illegally formed character string was encountered during translation.<br />
6706 The string contains an untranslatable character.<br />
6996 Invalid conversion or assignment operation on Period.<br />
198 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 4: Troubleshooting<br />
Reading <strong>Teradata</strong> T<strong>Pump</strong> Error Tables<br />
Table 29: <strong>Teradata</strong> T<strong>Pump</strong> Error Conditions (continued)<br />
Error<br />
Description<br />
7433 Invalid time.<br />
7441 Date not corresponding to an existing era.<br />
7442 Invalid era.<br />
7451 Invalid timestamp.<br />
7452 Invalid interval.<br />
7453 Invalid field overflow.<br />
7454 DateTime field overflow.<br />
7455 Invalid time specified.<br />
9102 Invalid CAST. The source character value must be valid for casting as PERIOD.<br />
Reading <strong>Teradata</strong> T<strong>Pump</strong> Error Tables<br />
<strong>Teradata</strong> T<strong>Pump</strong> error tables are a diagnostic device that help you locate and fix problems. For<br />
more information, refer to the description of these tables in “BEGIN LOAD”.<br />
Occasionally, <strong>Teradata</strong> T<strong>Pump</strong> encounters rows that cannot be correctly processed. When this<br />
happens, <strong>Teradata</strong> T<strong>Pump</strong> creates a row in the error table that is produced for each target<br />
table. Error tables are structured to provide enough information to reveal the cause of a<br />
problem and allow correction.<br />
In the case of missing, duplicate, or extra rows, these are noted in the error table only if the<br />
DML command specifies that requirement with the MARK parameter, which is the default for<br />
DML statements except for those participating in an upsert.<br />
Three error codes relate specifically to the incidence of missing, duplicate, and extra rows:<br />
• 2816: Failed to insert duplicate row into <strong>Teradata</strong> T<strong>Pump</strong> target table.<br />
This error occurs if MARK DUPLICATE INSERT/UPDATE ROWS is specified and a<br />
duplicate row is detected.<br />
• 2817: Activity count greater than one for <strong>Teradata</strong> T<strong>Pump</strong> UPDATE/DELETE.<br />
This error occurs if MARK EXTRA UPDATE/DELETE ROWS is specified and an activity<br />
count greater than one resulted. In this case, the error table row is inserted, but the<br />
corresponding UPDATE/DELETE also completes.<br />
• 2818: Activity count zero for <strong>Teradata</strong> T<strong>Pump</strong> UPDATE or DELETE.<br />
This error occurs if MARK MISSING UPDATE/DELETE ROWS is specified and an<br />
activity count of zero resulted.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 199
Chapter 4: Troubleshooting<br />
Reading <strong>Teradata</strong> T<strong>Pump</strong> Error Tables<br />
Avoiding <strong>Data</strong> Errors<br />
Acquisition Error Table<br />
The following data-related conditions can all cause records to be written to the error table:<br />
• A non-existent target table<br />
• Inadequate privileges to the target table<br />
• Mismatched table schema and <strong>Teradata</strong> T<strong>Pump</strong> DML<br />
• Attempting to store NULL value in a NOT NULL table column<br />
• Out-of-range values<br />
• <strong>Data</strong> conversion errors, which require input data to be corrected<br />
To help prevent performance issues, it is important to ensure that your data sources generate<br />
data records that are valid for the characteristic of the target tables.<br />
The error table is primarily used to hold information about errors that occur while <strong>Teradata</strong><br />
<strong>Data</strong>base is trying to redistribute the data during the acquisition phase. If <strong>Teradata</strong> <strong>Data</strong>base is<br />
unable to build a valid primary index, some application phase errors may be put into this<br />
table.<br />
Table 30 defines the Acquisition Error Table, with column entries comprising the unique<br />
primary index.<br />
Table 30: Acquisition Error Table<br />
Column <strong>Data</strong> Type Definition<br />
ImportSeq byteint Sequence number assigned to the IMPORT command in which<br />
the error occurred.<br />
DMLSeq byteint Sequence number assigned to the DML command in which the<br />
error occurred.<br />
SMTSeq byteint Sequence number of the DML statement in the DML command<br />
that was being executed while this error occurred.<br />
ApplySeq byteint Sequence number of apply clause in IMPORT command<br />
executing when error occurred.<br />
SourceSeq integer The data row number in the client file that the DBC was<br />
building when the error occurred.<br />
<strong>Data</strong>Seq byteint The data source where the record resides.<br />
ErrorCode char(255) The database code for the error.<br />
ErrorMsg char The corresponding error message for the error code.<br />
ErrorField smallint The number of the field in error if it can be determined.<br />
Host<strong>Data</strong> varbyte (63677) The first 63,677 bytes of client data associated with the error.<br />
LoadStartTime<br />
The beginning of the job time. On restart, LoadStartTime is the<br />
beginning of the restart time.<br />
200 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 4: Troubleshooting<br />
Reading <strong>Teradata</strong> T<strong>Pump</strong> Error Tables<br />
Interpreting Error Table Information<br />
The following <strong>Teradata</strong> T<strong>Pump</strong> task describes how to interpret the error table information to<br />
isolate and fix the problem. This task is greatly abbreviated, containing only the DML<br />
command and the IMPORT command. A probable sequence of actions for locating and fixing<br />
the problem follows the task.<br />
SEQ TYPE SEQ # Statement<br />
-------- --- -------------------------------------------------------<br />
DML 001 .DML LABEL FIRSTDML;<br />
STMT 001 INSERT INTO table1 VALUES( :FIELD1, :FIELD2 );<br />
STMT 002 UPDATE table2 SET field3 = :FIELD3 WHERE field4 =:FIELD4;<br />
DML 002 .DML LABEL SECNDDML;<br />
STMT 001 DELETE FROM table3 WHERE field3 = :FIELD3;<br />
IMPORT 001 .IMPORT INFILE file1 LAYOUT layout1<br />
APPLY 001 APPLY FIRSTDML;<br />
IMPORT 002 .IMPORT INFILE file2 LAYOUT layout2<br />
APPLY 001 APPLY FIRSTDML<br />
APPLY 002 APPLY SECNDDML;<br />
In this example, the Statement column represents the user entry. The SEQ # and SEQ TYPE<br />
columns are the Sequence Number and Sequence Type assigned to each statement. If an error<br />
occurs while using this task and the information in the following error table is displayed,<br />
where the error occurred and what was being executed at the time of the error can be<br />
determined.<br />
ImportSeq DMLSeq SMTSeq ApplySeq SourceSeq DBCErrorCode DBCErrorField<br />
--- --- --- --- --------- ----- ------------<br />
002 001 002 001 20456 2679 field3<br />
The following sequence provides a series of analytical steps for extracting and interpreting the<br />
information in this row of the error table.<br />
1 Check the DMLSeq field to find the statement being executed. It contains the sequence<br />
number 001.<br />
2 Check the SMTSeq field. The sequence number 002 in this field indicates that the error<br />
occurred while executing: change this statement of the first DML command, which is the<br />
UPDATE statement in the above task.<br />
3 Verify that the script shows that the DML command is used twice, once in each IMPORT.<br />
4 The value of 002 in the ImportSeq field shows that the error occurred in the second<br />
IMPORT clause.<br />
5 The value of 001 in the ApplySeq field indicates that the error occurred in the first apply of<br />
that clause, which was being executed when the error occurred.<br />
6 The value of 2679 in the DBCErrorCode field shows:<br />
The format or data contains a bad character<br />
which indicates that bad data is coming from the client.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 201
Chapter 4: Troubleshooting<br />
<strong>Teradata</strong> T<strong>Pump</strong> Performance Checklist<br />
7 The ErrorField field of the error row shows that the error occurred while building field3 of<br />
the table.<br />
8 The script then shows that the error occurred when field3 was being built from :FIELD3 in<br />
the client data.<br />
9 The LAYOUT clause in the script shows where the problem data is positioned within the<br />
row coming from the client.<br />
10 The script shows that the IMPORT clause with the error was loading file2, and indicates<br />
what error occurred, which statement detected the error, and which file has the error.<br />
11 The SourceSeq field of the error table pinpoints the problem location in the 20456th<br />
record of this file. The problem is isolated and can now be fixed.<br />
Most problems in the error tables do not require as much research as this example. This<br />
error was selected in order to use all of the information in the error table. As a rule, only<br />
one or two error table items need to be looked at to locate and correct problems.<br />
<strong>Teradata</strong> T<strong>Pump</strong> Performance Checklist<br />
The following checklist helps to isolate and analyze <strong>Teradata</strong> T<strong>Pump</strong> performance problems<br />
and their causes.<br />
• Monitor the <strong>Teradata</strong> T<strong>Pump</strong> job using the Monitor macros. Determine whether the job is<br />
making progress.<br />
• Check for locks using the <strong>Teradata</strong> <strong>Data</strong>base Showlocks utility. Transaction locks can be<br />
detected by checking for blocked <strong>Teradata</strong> utilities that use the performance monitor<br />
feature of <strong>Teradata</strong> <strong>Data</strong>base (<strong>Teradata</strong> Manager).<br />
• Check table DBC.Resusage for problem areas (for example, data bus capacity or CPU<br />
capacity at 100% for one or more processors).<br />
• Avoid large error tables, if possible, because error processing is generally expensive.<br />
• Verify that the primary index is unique. Nonunique primary indexes can cause severe<br />
<strong>Teradata</strong> T<strong>Pump</strong> performance problems.<br />
202 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
CHAPTER 5<br />
Using INMOD and Notify Exit Routines<br />
This chapter provides a detailed description of the INMOD feature used in <strong>Teradata</strong> T<strong>Pump</strong><br />
and the notify exit routines that are associated with INMODs.<br />
An INMOD is a user-generated module called by the IMPORT command, which reads data<br />
from a data source. <strong>Teradata</strong> T<strong>Pump</strong> honors INMODs developed for other load utilities.<br />
Owing to the complexity of this feature, it has been given a separate place in this chapter,<br />
rather than including it in the command syntax descriptions.<br />
The following information is included in this chapter:<br />
• Overview<br />
• Using INMOD and Notify Exit Routines<br />
Overview<br />
INMOD Routines<br />
This section provides an overview of the INMOD and notify exit routines. Information<br />
includes INMOD routines, notify exit routines, programming languages, programming<br />
structure, routine entry points, the <strong>Teradata</strong> T<strong>Pump</strong>/INMOD routine interface, the <strong>Teradata</strong><br />
T<strong>Pump</strong>/notify exit routine interface, and rules and restrictions for using routines.<br />
The term INMOD is an acronym for input modification routines. An INMOD is a<br />
user-written routine used by <strong>Teradata</strong> T<strong>Pump</strong> to supply or preprocess input records before<br />
they are sent to <strong>Teradata</strong> <strong>Data</strong>base.<br />
An INMOD routine can be used to supply input records or to perform preprocessing tasks on<br />
the input records before passing them to <strong>Teradata</strong> T<strong>Pump</strong>. Such tasks, for example, could:<br />
• Generate records to be passed to <strong>Teradata</strong> T<strong>Pump</strong>.<br />
• Validate data records before passing them to <strong>Teradata</strong> T<strong>Pump</strong>.<br />
• Read data directly from one or more database systems such as IMS, Total.<br />
• Convert fields in a data record before passing it to <strong>Teradata</strong> T<strong>Pump</strong>.<br />
The INMOD is specified as part of the IMPORT command. See “IMPORT” for INMOD<br />
syntax information.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 203
Chapter 5: Using INMOD and Notify Exit Routines<br />
Overview<br />
Notify Exit Routines<br />
A notify exit routine specifies a predefined action to be performed whenever certain<br />
significant events occur during a <strong>Teradata</strong> T<strong>Pump</strong> job.<br />
Notify exit routines are especially useful in an operator-free environment where job<br />
scheduling relies heavily on automation to optimize system performance.<br />
For example, by writing an exit routine in C (without using CLIv2) and using the NOTIFY . . .<br />
EXIT option of the BEGIN LOAD command, a routine can be provided to detect whether a<br />
<strong>Teradata</strong> T<strong>Pump</strong> job succeeds or fails, how many records were loaded, what the return code<br />
was for a failed job, and so on.<br />
Programming Languages<br />
<strong>Teradata</strong> T<strong>Pump</strong> is written in:<br />
• IBM C for channel-attached z/OS client systems<br />
• C for network-attached UNIX and Windows client systems<br />
INMOD and notify exit routines can be written in the programming languages listed in<br />
Table 31. They are dependent on the platform which runs <strong>Teradata</strong> T<strong>Pump</strong>:<br />
Table 31: INMOD Routines<br />
Platform<br />
Routines<br />
z/OS • INMOD routines in IBM C<br />
• Notify exit routines in IBM C<br />
UNIX, Windows • INMOD and notify exit routines in C<br />
204 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 5: Using INMOD and Notify Exit Routines<br />
Overview<br />
Programming Structure<br />
Table 32 defines the structure by programming language for communicating between<br />
<strong>Teradata</strong> T<strong>Pump</strong> and INMOD or notify exit routines.<br />
Table 32: Programming Routines by Language<br />
Routine Language<br />
C<br />
Programming Structure<br />
First parameter:<br />
struct {<br />
long Status;<br />
long RecordLength;<br />
char buffer[xxxxx];<br />
}<br />
Note: In the char buffer specification, the buffer length xxxxx is:<br />
• 32004 for <strong>Teradata</strong> for Windows<br />
• 64004 for <strong>Teradata</strong> <strong>Data</strong>base for UNIX<br />
Second parameter:<br />
struc<br />
long seqnum;<br />
short parmlen;<br />
char parm[80];<br />
}<br />
In each structure, the records must be constructed so that the left-to-right order of the data<br />
field corresponds to the order of the field names specified in the <strong>Teradata</strong> T<strong>Pump</strong> LAYOUT<br />
command and subsequent FIELD, FILLER, and TABLE commands.<br />
Routine Entry Points<br />
Table 33 lists the entry points for INMOD routines.<br />
Table 33: Entry Points for INMOD Routines<br />
INMOD Routine Language<br />
IBM C on z/OS platforms<br />
z/OS platform<br />
C on UNIX and Windows platforms<br />
Entry Point<br />
_dynamn<br />
DYNAMN<br />
_dynamn (or BLKEXIT*)<br />
*Only for FDL-compatible INMODs compiled and linked<br />
with BLKEXIT as the entry point. When the FDL-compatible<br />
INMOD is used, USING(“FDLINMOD”) must be specified<br />
in the IMPORT statement.<br />
Table 34 lists the entry points for Notify Exit routines.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 205
Chapter 5: Using INMOD and Notify Exit Routines<br />
Overview<br />
Table 34: NOTIFY EXIT Routine<br />
Notify Exit Routine Language<br />
IBM C on z/OS platforms<br />
z/OS platform<br />
C on UNIX and Windows platforms<br />
Entry Point<br />
_dynamn<br />
DYNAMN<br />
_dynamn<br />
The <strong>Teradata</strong> T<strong>Pump</strong>/INMOD Routine Interface<br />
<strong>Teradata</strong> T<strong>Pump</strong> exchanges information with an INMOD routine by using the conventional<br />
parameter register to point to a parameter list of two 32-bit addresses.<br />
The first 32-bit address points to a three-value structure consisting of status code, length, and<br />
body. The second 32-bit address points to a data structure containing a sequence number and<br />
a parameter list.<br />
Status Code<br />
Status Code is a 32-bit signed binary value that carries information in both directions.<br />
Table 35 lists <strong>Teradata</strong> T<strong>Pump</strong>-to-INMOD interface uses eight status codes, as defined in the<br />
table.<br />
Table 35: <strong>Teradata</strong> T<strong>Pump</strong>-to-INMOD Status Codes<br />
Value<br />
Description<br />
0 <strong>Teradata</strong> T<strong>Pump</strong> is calling for the first time and expects the INMOD routine to return a<br />
record.<br />
At this point, the INMOD routine should perform its initialization tasks before sending a<br />
data record to <strong>Teradata</strong> T<strong>Pump</strong>.<br />
1 <strong>Teradata</strong> T<strong>Pump</strong> is calling, not for the first time and expects the INMOD routine to return<br />
a record.<br />
2 The client system has been restarted, the INMOD routine should reposition to the last<br />
checkpoint, and <strong>Teradata</strong> T<strong>Pump</strong> is not expecting the INMOD routine to return a data<br />
record.<br />
Note: If the client system restarts before the first checkpoint, <strong>Teradata</strong> T<strong>Pump</strong> sends entry<br />
code 0 to re-initialize. Repositioning information, provided by the INMOD after a code 3,<br />
is read from the restart log table and returned in the buffer normally used for the data<br />
record.<br />
3 A checkpoint has been written, the INMOD routine should remember the checkpoint<br />
position, and <strong>Teradata</strong> T<strong>Pump</strong> does not expect the INMOD routine to return a data<br />
record.<br />
In the buffer normally used to return data, the INMOD should return any information<br />
(up to 100 bytes) needed to reposition to this checkpoint. The utility saves this<br />
information in the restart log table.<br />
206 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 5: Using INMOD and Notify Exit Routines<br />
Overview<br />
Table 35: <strong>Teradata</strong> T<strong>Pump</strong>-to-INMOD Status Codes (continued)<br />
Value<br />
Description<br />
4 <strong>Teradata</strong> <strong>Data</strong>base has failed, the INMOD routine should reposition to the last<br />
checkpoint, and <strong>Teradata</strong> T<strong>Pump</strong> is not expecting the INMOD routine to return a data<br />
record.<br />
Note: If the database restarts before the first checkpoint, <strong>Teradata</strong> T<strong>Pump</strong> sends entry<br />
code 5 for cleanup, and then it sends entry code 0 to re-initialize.<br />
<strong>Teradata</strong> T<strong>Pump</strong> reads the repositioning information, provided by the INMOD after a<br />
code 3, from the restart log table and returned to the INMOD in the buffer normally used<br />
for the data record.<br />
5 The <strong>Teradata</strong> T<strong>Pump</strong> job has ended and the INMOD routine should perform any<br />
required cleanup tasks.<br />
6 The INMOD should initialize and prepare to receive records.<br />
7 The next record is available for the INMOD.<br />
Table 36 explains the two status codes used by the INMOD-to-<strong>Teradata</strong> T<strong>Pump</strong> interface.<br />
Table 36: INMOD-to-<strong>Teradata</strong> T<strong>Pump</strong> Interface Status Codes<br />
Value<br />
Description<br />
0 A record is being returned as the body value for a read call (code 1).<br />
For calls other than read, a value of 0 indicates successful completion.<br />
Any nonzero<br />
value<br />
The INMOD routine is at an end-of-file condition for a read call (code 1). For calls<br />
other than read, a nonzero value indicates a processing error that terminates<br />
<strong>Teradata</strong> T<strong>Pump</strong>.<br />
Length<br />
Length is the 32-bit binary value that the INMOD routine uses to specify the length, in bytes,<br />
of the data record. The INMOD routine can use a length value of zero to indicate an end-offile<br />
condition.<br />
Body<br />
Body is the area where the INMOD routine places the data record. Maximum record length is<br />
31K or 31,744 bytes for <strong>Teradata</strong> for Windows. Maximum record length for <strong>Teradata</strong> <strong>Data</strong>base<br />
for UNIX is 62K or 63,488 bytes.<br />
Sequence Number<br />
Sequence number is a 4-byte integer record counter portion of the source sequence number.<br />
Parameter List<br />
The parameter list in the second 32-bit address consists of the following:<br />
• VARCHAR specification<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 207
Chapter 5: Using INMOD and Notify Exit Routines<br />
Overview<br />
• Two-byte length specification, m<br />
• The m-byte parms string, as parsed and presented by <strong>Teradata</strong> T<strong>Pump</strong><br />
Caution:<br />
To prevent data corruption, INMOD routines that cannot comply with these protocols should<br />
terminate if they encounter a restart code 2, 3, or 4. To support proper <strong>Teradata</strong> T<strong>Pump</strong> restart<br />
operations, INMOD routines must save and restore checkpoint information as described here.<br />
If the INMOD saves checkpoint information in some other manner, a subsequent restart/<br />
recovery operation could result in data loss or corruption.<br />
<strong>Teradata</strong> T<strong>Pump</strong>/Notify Exit Routine Interface<br />
<strong>Teradata</strong> T<strong>Pump</strong> accumulates operational information about specific events that occur during<br />
a <strong>Teradata</strong> T<strong>Pump</strong> job. If the BEGIN LOAD command includes a NOTIFY option with an<br />
EXIT specification, then, when the specific events occur, <strong>Teradata</strong> T<strong>Pump</strong> calls the named<br />
notify exit routine and passes to it:<br />
• An event code to identify the event<br />
• Specific information about the event<br />
Table 37 lists the event codes and describes the data that <strong>Teradata</strong> T<strong>Pump</strong> passes to the notify<br />
exit routine for each event. (See the description of the NOTIFY option in the “BEGIN LOAD”<br />
command description in Chapter 3: “<strong>Teradata</strong> T<strong>Pump</strong> Commands,” for a description of the<br />
events associated with each level of notification—low, medium, high, and ultra.)<br />
Note: To support future enhancements, always make sure that the notify exit routines ignore<br />
invalid or undefined event codes, and that they do not cause <strong>Teradata</strong> T<strong>Pump</strong> to terminate<br />
abnormally.<br />
Table 37: Events Passed to the Notify Exit Routine<br />
Event<br />
Event<br />
Code Event Description <strong>Data</strong> Passed to the Notify Exit Routine<br />
Initialize 0 Successful processing of the NOTIFY<br />
option of the BEGIN LOAD<br />
command.<br />
• Version ID length—4-byte unsigned integer<br />
• Version ID string—32-character (maximum) array<br />
• Utility ID—4-byte unsigned integer<br />
• Utility name length—4-byte unsigned integer<br />
• Utility name string—36-character (maximum)<br />
array<br />
• User name length—4-byte unsigned integer<br />
• User name string—64-character (maximum) array<br />
• Optional string length—4-byte unsigned integer<br />
• Optional string—80-character (maximum) array<br />
File or INMOD<br />
open<br />
1 Successful processing of the IMPORT<br />
command that specifies the file or<br />
INMOD routine name<br />
• File name length—4-byte unsigned integer<br />
• File name—256-character (maximum) array<br />
• Import number—4-byte unsigned integer<br />
Checkpoint begin 2 <strong>Teradata</strong> T<strong>Pump</strong> is about to perform<br />
a checkpoint operation<br />
Record number—4-byte unsigned integer<br />
208 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 5: Using INMOD and Notify Exit Routines<br />
Overview<br />
Table 37: Events Passed to the Notify Exit Routine (continued)<br />
Event<br />
Event<br />
Code Event Description <strong>Data</strong> Passed to the Notify Exit Routine<br />
Import begin 3 The first record is about to be read for<br />
each import task<br />
Import end 4 The last record has been read for each<br />
import task. The returned data is the<br />
record statistics for the import task<br />
Error table 5 Processing of the SEL COUNT(*)<br />
request completed successfully for the<br />
error table<br />
Import number—4-byte unsigned integer<br />
• Import number—4-byte unsigned integer<br />
• Records read—4-byte unsigned integer<br />
• Records skipped—4-byte unsigned integer<br />
• Records rejected—4-byte unsigned integer<br />
• Records sent to <strong>Teradata</strong> <strong>Data</strong>base—4-byte<br />
unsigned integer<br />
• <strong>Data</strong> errors—4-byte unsigned integer<br />
• Table name—128-byte character (maximum) array<br />
• Number of rows—4-byte unsigned integer<br />
<strong>Teradata</strong> <strong>Data</strong>base<br />
restart<br />
6 <strong>Teradata</strong> T<strong>Pump</strong> received a crash<br />
message from <strong>Teradata</strong> <strong>Data</strong>base or<br />
from the CLIv2<br />
No data accompanies the <strong>Teradata</strong> <strong>Data</strong>base restart<br />
event code<br />
CLIv2 error 7 <strong>Teradata</strong> T<strong>Pump</strong> received a CLIv2<br />
error<br />
Error code—4-byte unsigned integer<br />
<strong>Teradata</strong> <strong>Data</strong>base<br />
error<br />
8 <strong>Teradata</strong> T<strong>Pump</strong> received a <strong>Teradata</strong><br />
<strong>Data</strong>base error that will produce an<br />
exit code of 12<br />
Error code—4-byte unsigned integer<br />
Note: Not all <strong>Teradata</strong> <strong>Data</strong>base errors cause this<br />
event. A 3807 error, for example, while trying to drop<br />
or create a table, does not terminate <strong>Teradata</strong> T<strong>Pump</strong>.<br />
Exit 9 <strong>Teradata</strong> T<strong>Pump</strong> completed a load<br />
task<br />
Table statistics 10 <strong>Teradata</strong> T<strong>Pump</strong> has successfully<br />
written the table statistics<br />
Checkpoint end 11 <strong>Teradata</strong> T<strong>Pump</strong> successfully<br />
completed the checkpoint operation<br />
Exit code—4-byte unsigned integer<br />
• Type (I = Insert, U = Update, or D = Delete) —<br />
1-byte character variable<br />
• <strong>Data</strong>base name—64-character (maximum) array<br />
• Table/macro name—64-character (maximum)<br />
array<br />
• Activity count—4-byte unsigned integer<br />
Record number—4-byte unsigned integer<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 209
Chapter 5: Using INMOD and Notify Exit Routines<br />
Overview<br />
Table 37: Events Passed to the Notify Exit Routine (continued)<br />
Event<br />
Event<br />
Code Event Description <strong>Data</strong> Passed to the Notify Exit Routine<br />
Interim run<br />
statistics<br />
12 <strong>Teradata</strong> T<strong>Pump</strong> is updating the<br />
Monitor Interface table, has just<br />
completed a checkpoint, or has read<br />
the last record for an import task. The<br />
returned data is the statistics for the<br />
current load<br />
• Import number—4-byte unsigned integer<br />
• Statements sent to <strong>Teradata</strong> <strong>Data</strong>base—4-byte<br />
unsigned integer<br />
• Requests sent to <strong>Teradata</strong> <strong>Data</strong>base—4-byte<br />
unsigned integer<br />
• Records read—4-byte unsigned integer<br />
• Records skipped—4-byte unsigned integer<br />
• Records rejected—4-byte unsigned integer<br />
• Records sent to <strong>Teradata</strong> <strong>Data</strong>base—4-byte<br />
unsigned integer<br />
• <strong>Data</strong> errors—4-byte unsigned integer<br />
DML error 13 <strong>Teradata</strong> T<strong>Pump</strong> received a <strong>Teradata</strong><br />
<strong>Data</strong>base error that was caused by<br />
DML and will introduce an error-row<br />
insert to the error table<br />
• Import number—4-byte unsigned integer<br />
• Error code—4-byte unsigned integer<br />
• Error message—256-character (maximum) array<br />
• Record number—4-byte unsigned integer<br />
• Apply number—1-byte unsigned char<br />
• DML number—1-byte unsigned char<br />
• Statement number—1-byte unsigned char<br />
• Record data—64,004-character (maximum) array<br />
• Record data length—4-byte unsigned integer<br />
• Feedback—a pointer to 4-byte unsigned integer<br />
“Feedback” always points to integer 0 when it is passed<br />
to the user exit routine. The user may change the value<br />
of this integer to 1 to instruct <strong>Teradata</strong> T<strong>Pump</strong> not to<br />
log the error to the error table. In this case, <strong>Teradata</strong><br />
T<strong>Pump</strong> will not log the error, but continue other<br />
regular process on this error.<br />
210 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 5: Using INMOD and Notify Exit Routines<br />
Overview<br />
Rules and Restrictions for Using Routines<br />
The following sections describe the operational rules and restrictions for using INMOD and<br />
notify exit routines in <strong>Teradata</strong> T<strong>Pump</strong> jobs.<br />
Specifying Routines<br />
INMOD and notify exit routine names must be unique within the system.<br />
A <strong>Teradata</strong> T<strong>Pump</strong> job can specify one INMOD routine with each IMPORT command. These<br />
specifications can be to the same or different INMOD routines.<br />
In addition to the multiple INMOD routines, each <strong>Teradata</strong> T<strong>Pump</strong> job can specify an exit<br />
routine with the NOTIFY... EXIT option of the BEGIN LOAD command.<br />
Compiling and Linking Routines<br />
The methods for compiling and linking routines vary with the operating system. The<br />
following sections describe the methods for z/OS, UNIX, and Windows.<br />
Using z/OS<br />
On channel-attached z/OS client systems, INMOD and notify exit routines must be compiled<br />
under IBM C.<br />
Using UNIX<br />
On network-attached UNIX client systems, INMOD and notify exit routines must:<br />
• Be compiled with the MetaWare High C compiler<br />
• Be linked into a shared object module<br />
• Use an entry point named _dynamn<br />
Using Windows<br />
On network-attached Windows client systems, INMOD and notify exit routines must:<br />
• Be written in C<br />
• Have a dynamn entry point that is a _declspec<br />
• Be saved as a Dynamic Link Library (DLL) file<br />
For more information, see the examples in Appendix C: “INMOD and Notify Exit Routine<br />
Examples” for sample programs and procedures that compile and link INMOD and notify<br />
exit routines for the operating system environment.<br />
Addressing Mode on z/OS Systems<br />
Either 31-bit or 24-bit addressing for INMOD routines can be used on channel-attached<br />
systems. The 31-bit mode provides access to more memory, which enhances performance for<br />
<strong>Teradata</strong> T<strong>Pump</strong> jobs with a large number of sessions.<br />
Use the following linkage parameters to specify the addressing mode when building INMOD<br />
routines for z/OS systems:<br />
• For 31-bit addressing: AMODE(31) RMODE(24)<br />
• For 24-bit addressing: AMODE(24) RMODE(24)<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 211
Chapter 5: Using INMOD and Notify Exit Routines<br />
Overview<br />
INMOD Routine Compatibility with Other Load Utilities<br />
FDL-compatible INMOD routines that were created for FastLoad by including the<br />
FDLINMOD parameter as the USING (parms) option of the IMPORT command can be used.<br />
Using this parameter provides compatible support operations except for the way<br />
checkpointing is performed:<br />
• If a <strong>Teradata</strong> T<strong>Pump</strong> job uses the FROM, FOR, or THRU options to request a range of<br />
records from an FDL-compatible INMOD routine, then <strong>Teradata</strong> T<strong>Pump</strong> bypasses any<br />
default record checkpoint function. By default, <strong>Teradata</strong> T<strong>Pump</strong> takes a checkpoint every<br />
15 minutes. The <strong>Teradata</strong> T<strong>Pump</strong> checkpoint function can be bypassed by specifying a<br />
CHECKPOINT rate of zero in your BEGIN LOAD commands.<br />
If <strong>Teradata</strong> <strong>Data</strong>base experiences a restart/recovery operation, <strong>Teradata</strong> T<strong>Pump</strong> starts over<br />
and gets the records again from the beginning of the range.<br />
Under these same circumstances, if a BEGIN LOAD command included a CHECKPOINT<br />
rate other than zero, <strong>Teradata</strong> T<strong>Pump</strong> terminates with an error condition.<br />
• If a <strong>Teradata</strong> T<strong>Pump</strong> job does not request a range of records, then <strong>Teradata</strong> T<strong>Pump</strong><br />
performs checkpointing either by default (every 15 minutes) or per the job specifications.<br />
If <strong>Teradata</strong> <strong>Data</strong>base experiences a restart/recovery operation and the INMOD routine<br />
supports recovery, <strong>Teradata</strong> T<strong>Pump</strong> continues the data acquisition activity from the last<br />
recorded checkpoint.<br />
Note, however, that the source sequence numbers generated by <strong>Teradata</strong> T<strong>Pump</strong> may not<br />
correctly identify the sequence in which the INMOD routine supplied the records. The<br />
data is still applied correctly, however, despite this discrepancy.<br />
An FDL-compatible INMOD routine cannot be specified with the INFILE specification of a<br />
<strong>Teradata</strong> T<strong>Pump</strong> IMPORT command.<br />
When an INMOD routine is specified with the INFILE specification:<br />
• <strong>Teradata</strong> T<strong>Pump</strong> performs the file-read operation<br />
• The INMOD routine acts as a pass-through filter<br />
The combination of an FDL-compatible INMOD routine with a <strong>Teradata</strong> T<strong>Pump</strong> INFILE<br />
specification is not valid because an FDL-compatible INMOD routine must always perform<br />
the file read operation.<br />
Checkpoints<br />
To support <strong>Teradata</strong> T<strong>Pump</strong> restart operations, the INMOD routine must support checkpoint<br />
operations, as described in “The <strong>Teradata</strong> T<strong>Pump</strong>/INMOD Routine Interface” on page 206.<br />
If an INMOD routine that does not support the checkpoint function is used, the job may<br />
encounter problems when <strong>Teradata</strong> T<strong>Pump</strong> takes a checkpoint.<br />
By default, <strong>Teradata</strong> T<strong>Pump</strong> takes a checkpoint every 15 minutes. The <strong>Teradata</strong> T<strong>Pump</strong><br />
checkpoint function can be bypassed by specifying a CHECKPOINT rate of zero in the<br />
BEGIN LOAD command; that way, the job completes without taking a checkpoint.<br />
Though this would nullify the <strong>Teradata</strong> T<strong>Pump</strong> restart/reload capability, it would allow an<br />
INMOD routine that does not support the checkpoint function to be used.<br />
212 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 5: Using INMOD and Notify Exit Routines<br />
Using INMOD and Notify Exit Routines<br />
Using INMOD and Notify Exit Routines<br />
This section provides some specific information required for using INPUT and notify exit<br />
routines in <strong>Teradata</strong> T<strong>Pump</strong>. Topics include <strong>Teradata</strong> T<strong>Pump</strong>-specific restrictions, the<br />
<strong>Teradata</strong> T<strong>Pump</strong>/INMOD interface for different client operating systems, preparation of the<br />
INMOD program, INMOD input values, INMOD output values, and programming<br />
specifications for Unix-based and Windows clients.<br />
<strong>Teradata</strong> T<strong>Pump</strong>-specific Restrictions<br />
INMOD names should be unique within the system. INMODs are not re-entrant and cannot<br />
be shared by two <strong>Teradata</strong> T<strong>Pump</strong> (or FastLoad, MultiLoad, or FastExport) sessions at the<br />
same time.<br />
Some changes have been made to the INMOD utility interface for <strong>Teradata</strong> T<strong>Pump</strong> because of<br />
operational differences between <strong>Teradata</strong> T<strong>Pump</strong> and the older utilities. For compatibility<br />
with INMODs, the FDLINMOD parameter should be used. The use of this parm provides<br />
support of existing INMODs, with the following restrictions:<br />
• When the FDLINMOD parm is used, INMODs that are compatible with other utilities<br />
may be used. However, if a range of records is requested from an FDL-compatible INMOD<br />
(using FROM, FOR, or THRU on the IMPORT command), <strong>Teradata</strong> T<strong>Pump</strong> bypasses any<br />
default record checkpointing. If there is a recovery under these circumstances, <strong>Teradata</strong><br />
T<strong>Pump</strong> starts over and acquires the records again from the beginning of the range. Under<br />
these same circumstances, if checkpointing is requested by specifying the CHECKPOINT<br />
parameter on the BEGIN LOAD command, <strong>Teradata</strong> T<strong>Pump</strong> terminates with an error.<br />
• If a range of records is not requested when using an FDL-compatible INMOD, <strong>Teradata</strong><br />
T<strong>Pump</strong> performs checkpointing, either by default or by the user’s request. If there is a<br />
recovery and the INMOD supports recovery, <strong>Teradata</strong> T<strong>Pump</strong> continues its data<br />
acquisition from the last recorded checkpoint. However, the source sequence numbers<br />
generated by <strong>Teradata</strong> T<strong>Pump</strong> may not correctly identify the sequence in which the<br />
INMOD supplied the records. Despite this discrepancy, the data is still applied correctly.<br />
• An FDL-compatible INMOD routine cannot be specified in conjunction with the INFILE<br />
specification of a <strong>Teradata</strong> T<strong>Pump</strong> IMPORT command. If an INMOD is specified together<br />
with the INFILE specification, <strong>Teradata</strong> T<strong>Pump</strong> performs the file read operation and the<br />
INMOD acts as a pass-through filter. Since an FDL-compatible INMOD always performs<br />
the file read operation, it is not valid with a <strong>Teradata</strong> T<strong>Pump</strong> INFILE specification.<br />
Warning:<br />
The <strong>Teradata</strong> T<strong>Pump</strong> default is to take a checkpoint every 15 minutes. With other loading<br />
utilities, checkpointing must be explicitly requested. If an attempt to run with an INMOD that<br />
does not use checkpointing is made, problems may arise when <strong>Teradata</strong> T<strong>Pump</strong> defaults to a<br />
checkpoint mode. To avoid this condition, <strong>Teradata</strong> T<strong>Pump</strong> checkpointing by specifying zero<br />
can be disabled as the checkpoint rate parameter on the BEGIN LOAD command, so that the<br />
checkpoint is never reached. This may be imperative for users who do not have INMODs capable<br />
of checkpointing.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 213
Chapter 5: Using INMOD and Notify Exit Routines<br />
Using INMOD and Notify Exit Routines<br />
<strong>Teradata</strong> T<strong>Pump</strong>/INMOD Interface<br />
This section discusses the <strong>Teradata</strong> T<strong>Pump</strong>/INMOD Interface for different client operating<br />
systems:<br />
<strong>Teradata</strong> T<strong>Pump</strong>/INMOD Interface on IBM Client-based Systems<br />
The use of an INMOD is specified on the IMPORT command. On IBM client-based systems,<br />
<strong>Teradata</strong> <strong>Data</strong>base interfaces with INMODs written in C.<br />
Examples of these INMODs are presented in Appendix C: “INMOD and Notify Exit Routine<br />
Examples”. An optional parms string to be passed to the INMOD may also be specified on the<br />
IMPORT command. <strong>Teradata</strong> T<strong>Pump</strong> imposes the following syntax rules for this string:<br />
• The parms string may include one or more character strings, each delimited on either end<br />
by apostrophes or quotation marks. The maximum size of the parms string is 1 KB.<br />
• If a FastLoad INMOD is used, the parms string of the IMPORT command must be<br />
FDLINMOD.<br />
• The parms string passed to an INMOD includes the parentheses used to specify the parm.<br />
Thus, if the IMPORT specifies USING ('5'), the entire expression ('5') is passed to the<br />
INMOD.<br />
• Parentheses within delimited character strings or comments have the same syntactical<br />
significance as alphabetic characters.<br />
• In the parms string that <strong>Teradata</strong> T<strong>Pump</strong> passes to the INMOD routine, each comment is<br />
replaced by a single blank character.<br />
• In the parms string that <strong>Teradata</strong> T<strong>Pump</strong> passes to the INMOD routine, each consecutive<br />
sequence of whitespace characters, such as blank, tab, and so on, that appears outside of<br />
delimited strings, is replaced by a single blank character.<br />
• FDLINMOD is used for compatibility by pointing to a data structure that is the same for<br />
BDL and FDL INMODs.<br />
<strong>Teradata</strong> T<strong>Pump</strong>/INMOD Interface on UNIX-based Systems<br />
On UNIX-based client platforms, <strong>Teradata</strong> T<strong>Pump</strong> is written in C and, therefore, the INMOD<br />
procedure is dynamically loaded at runtime, rather than link-edited into the <strong>Teradata</strong> T<strong>Pump</strong><br />
module or operated as a separate executable program.<br />
The runtime loader requires that the INMOD module be compiled and linked as a shared<br />
object, and that the entry point for the procedure be named _dynamn.<br />
The use of an INMOD is specified in the IMPORT command. On UNIX-based systems,<br />
<strong>Teradata</strong> <strong>Data</strong>base interfaces only with INMODs written in C. An example of a C INMOD is<br />
presented in Appendix C: “INMOD and Notify Exit Routine Examples”. An optional parms<br />
string to be passed to the INMOD may also be specified on the IMPORT command. <strong>Teradata</strong><br />
T<strong>Pump</strong> imposes these syntax rules:<br />
• One INMOD is allowed for each IMPORT command. Multiple IMPORTs are allowed;<br />
these may use the same or different INMODs.<br />
• The input filename parameter specified on the IMPORT command must be the<br />
fully qualified UNIX pathname for the input file.<br />
214 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 5: Using INMOD and Notify Exit Routines<br />
Using INMOD and Notify Exit Routines<br />
• The INMOD filename parameter specified on the IMPORT command must be the<br />
fully qualified UNIX pathname of the INMOD shared object file.<br />
• The parms string may include one or more character strings, each delimited on either end<br />
by an apostrophe, or delimited on either end by a quotation mark. The maximum size of<br />
the parms string is 1k bytes.<br />
• If a FastLoad INMOD is used, the parms string of the IMPORT command must be<br />
“FDLINMOD”.<br />
• The parms string as a whole must be enclosed in parentheses.<br />
• Parentheses within delimited character strings or comments have the same syntactical<br />
significance as alphabetic characters.<br />
• In the parms string that <strong>Teradata</strong> T<strong>Pump</strong> passes to the INMOD routine, each comment is<br />
replaced by a single blank character.<br />
• In the parms string that <strong>Teradata</strong> T<strong>Pump</strong> passes to the INMOD routine, each consecutive<br />
sequence of whitespace characters, such as blank, tab, and so on, that appears outside of<br />
delimited strings, is replaced by a single blank character.<br />
• FDLINMOD is used for compatibility by pointing to a data structure that is the same for<br />
FDL INMODs.<br />
<strong>Teradata</strong> T<strong>Pump</strong>/INMOD Interface on Windows Systems<br />
On Windows client platforms, <strong>Teradata</strong> T<strong>Pump</strong> is written in C and, therefore, the INMOD<br />
procedure is dynamically loaded at runtime, rather than link-edited into the <strong>Teradata</strong> T<strong>Pump</strong><br />
module or run as a separate executable program.<br />
The runtime loader requires that the INMOD module be compiled and linked as a Dynamic-<br />
Link Library (DLL) file, and that the point for the procedure be named _dynamn.<br />
The use of an INMOD is specified in the IMPORT command. On systems, <strong>Teradata</strong><br />
<strong>Data</strong>base interfaces only with written in C. An optional parms string to be passed to INMOD<br />
may also be specified on the IMPORT command. <strong>Teradata</strong> T<strong>Pump</strong> imposes the following<br />
syntax rules:<br />
• One INMOD is allowed for each IMPORT command. Multiple are allowed; these may use<br />
the same or different INMODs.<br />
• The input filename parameter specified on the IMPORT command must be the fully<br />
qualified Windows pathname for the input file.<br />
• The INMOD filename parameter specified on the IMPORT command must be the fully<br />
qualified Windows pathname of the INMOD DLL file.<br />
• The parms string may include one or more character strings, each delimited on either end<br />
by an apostrophe, or delimited on either end by a quotation mark. The maximum size of<br />
the parms string is 1k bytes.<br />
• If a FastLoad INMOD is used, the parms string of the IMPORT command must be<br />
“FDLINMOD”.<br />
• The parms string as a whole must be enclosed in parentheses.<br />
• Parentheses within delimited character strings or comments have the same syntactical<br />
significance as alphabetic characters.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 215
Chapter 5: Using INMOD and Notify Exit Routines<br />
Preparing the INMOD Program<br />
• In the parms string that <strong>Teradata</strong> T<strong>Pump</strong> passes to the INMOD routine, each comment is<br />
replaced by a single blank character.<br />
• In the parms string that <strong>Teradata</strong> T<strong>Pump</strong> passes to the INMOD routine, each consecutive<br />
sequence of whitespace characters, such as blank, tab, and so on, that appears outside of<br />
delimited strings, is replaced by a single blank character.<br />
• FDLINMOD is used for compatibility by pointing to a data structure that is the same for<br />
FDL INMODs.<br />
Preparing the INMOD Program<br />
This section describes the protocol used between <strong>Teradata</strong> T<strong>Pump</strong> and an INMOD written for<br />
<strong>Teradata</strong> T<strong>Pump</strong>. The protocols are applicable to all client platforms running <strong>Teradata</strong><br />
T<strong>Pump</strong>. Considerations applicable exclusively to UNIX-based clients are contained in<br />
“Programming INMODs for UNIX-based Clients” on page 218.<br />
On entry to an INMOD user exit routine for <strong>Teradata</strong> T<strong>Pump</strong>, the conventional parameter<br />
register points to a parameter list of two 32-bit addresses. The first 32-bit address points to a<br />
data structure containing the following fields:<br />
• Return Code/Function Code, 4-byte integer.<br />
• Length, 4-byte integer, Length of the data record.<br />
• <strong>Data</strong> Record, Input data record buffer. The maximum length is:<br />
• 31K or 31,744 bytes for <strong>Teradata</strong> for Windows<br />
• 62K or 63,488 bytes for <strong>Teradata</strong> <strong>Data</strong>base for UNIX<br />
INMOD Input Values<br />
Table 38 lists valid values of the Return Code/Function Code field and their meanings As<br />
input to the INMOD routine, as input to the INMOD routine.<br />
Table 38: INMOD Input Return Code Values<br />
Code<br />
Description<br />
0 Request for INMOD to initialize and return first record.<br />
1 Request for INMOD to return a record.<br />
2 Request for INMOD to reposition to last checkpoint because of client restart. Repositioning<br />
information, provided by the INMOD after a code 3, is read from the restart logtable and<br />
returned to the INMOD in the buffer normally used for the data record.<br />
3 Request for INMOD to take a checkpoint. In the buffer normally used to return data, the<br />
INMOD should return any information (up to 100 bytes) that it may need to reposition to<br />
this checkpoint. <strong>Teradata</strong> T<strong>Pump</strong> then saves this information in its restart log table.<br />
216 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 5: Using INMOD and Notify Exit Routines<br />
INMOD Output Values<br />
Table 38: INMOD Input Return Code Values (continued)<br />
Code<br />
Description<br />
4 Request for INMOD to reposition to last checkpoint because of a <strong>Teradata</strong> <strong>Data</strong>base failure.<br />
Repositioning information, provided by the INMOD after a code 3, is read from the restart<br />
log table and returned to the INMOD in the buffer normally used for the data record.<br />
5 Request for INMOD to wrap up at termination.<br />
6 Request for INMOD to initialize.<br />
7 Request for INMOD to receive first (next) record.<br />
INMOD Output Values<br />
Table 39 lists valid values of the Return Code field and their meanings, as output to the<br />
INMOD routine.<br />
Table 39: INMOD Output Return Code Values<br />
Code<br />
Description<br />
0 on read call (code 1) Indicates End Of File not reached. The length field should be<br />
set to the length of the output record. If an input record was<br />
supplied to the INMOD and it is to be skipped, set the length<br />
field to zero. If no input record was supplied, setting the<br />
length to zero acts as an End Of File.<br />
Non-0 on read call (code 1)<br />
Indicates End Of File.<br />
0 on non-read call (not code 1) Indicates successful operation.<br />
Non-0 on non-read call (not code 1)<br />
Indicates a processing error. <strong>Teradata</strong> T<strong>Pump</strong> terminates.<br />
The second 32-bit address points to a data structure containing the following fields:<br />
• Sequence Number, 4-byte integer, Integer record counter portion of the source sequence<br />
number.<br />
• Parameter List, Varchar, 2-byte length, m, followed by the m-byte parms string as parsed<br />
and presented by <strong>Teradata</strong> T<strong>Pump</strong>.<br />
INMODs that cannot comply with these protocols should terminate if a Restart Code 2,<br />
Code 3, or Code 4 is encountered. Otherwise, data might become corrupted. In order to be<br />
restartable, INMODs must make use of <strong>Teradata</strong> T<strong>Pump</strong> to save and restore checkpoint<br />
information as described above. If the INMOD saves its checkpointing information privately,<br />
recovery might result in data corruption.<br />
Note: On z/OS, the module must reside in the steplib/joblib (for JCL), task library (for clist/<br />
exec), or the system linklist (for any).<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 217
Chapter 5: Using INMOD and Notify Exit Routines<br />
Programming INMODs for UNIX-based Clients<br />
Programming INMODs for UNIX-based Clients<br />
In addition to the techniques for preparing INMODs listed in “Preparing the INMOD<br />
Program” on page 216 which apply to all platforms, there are several rules that must be<br />
followed only for developing C INMODs for UNIX-based clients. These are:<br />
• The INMOD subroutine must be named _dynamn.<br />
• The INMOD must be compiled with the MetaWare High C compiler.<br />
• The compiled INMOD module must be linked into a shared object module.<br />
Compiling and Linking a C INMOD on a UNIX-based Client<br />
Note: For a description of the syntax diagrams used in this book, see Appendix A: “How to<br />
Read Syntax Diagrams.”<br />
The following syntax example can be used to compile a C INMOD on a UNIX-based client.<br />
Compile Syntax<br />
cc -c inmod.c<br />
3021A038<br />
where<br />
Syntax Element<br />
cc<br />
c<br />
inmod.c<br />
Description<br />
Program that invokes the MetaWare High C Compiler<br />
Linker option specifying to compile without linking to produce an output file<br />
(a.out)<br />
A C source module for the INMOD<br />
Use the following syntax example to link the object modules into a shared object module.<br />
Link Syntax<br />
,<br />
ld -dy -G inmod.o -o inmod.so<br />
HE05A016<br />
where<br />
218 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 5: Using INMOD and Notify Exit Routines<br />
Programming INMODs for UNIX-based Clients<br />
Syntax Element<br />
ld<br />
dy<br />
G<br />
inmod.o<br />
o<br />
inmod.so<br />
Description<br />
Invokes the UNIX linker editor<br />
Specifies to use dynamic linking<br />
Specifies to create a shared object<br />
Describes an object module derived from the compile step (see above)<br />
Specifies the output filename; default is a.out<br />
Specifies the resulting shared object module<br />
This is the user-specified name in the IMPORT command.<br />
Note: Object modules can be linked into shared objects or shared libraries (i.e.,<br />
.so or .sl extension respectively) on HP-UX Itanium.<br />
Compiling and Linking a C INMOD on Sun Solaris SPARC<br />
Use the following syntax example to compile a C INMOD on Sun Solaris SPARC client<br />
systems.<br />
cc -G<br />
-KPIC<br />
sourcefile.c<br />
-o shared-object-name<br />
2409B051<br />
where<br />
Syntax Element<br />
cc<br />
Description<br />
Invokes the MetaWare High C Compiler<br />
-G Specifies to create a shared object<br />
-KPIC<br />
sourcefile<br />
Is a compiler option that generates Position Independent Code (PIC) for all user<br />
exit routine<br />
Is a C source module for the INMOD<br />
-o Specifies the output file name<br />
shared-objectname<br />
Specifies the resulting shared object module<br />
This is the name specified as:<br />
• The INMOD modulename parameter of the IMPORT command of the<br />
T<strong>Pump</strong> job script<br />
• The EXIT name parameter for the NOTIFY option of the BEGIN LOAD<br />
command of the T<strong>Pump</strong> job script<br />
The shared-object-name can be any valid UNIX file name.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 219
Chapter 5: Using INMOD and Notify Exit Routines<br />
Programming INMODs for UNIX-based Clients<br />
Compiling and Linking a C INMOD on a Sun Solaris Opteron<br />
Use the following syntax example to compile a C INMOD on a Sun Solaris Opteron client<br />
system.<br />
cc<br />
-dy<br />
-G<br />
sourcefile.c<br />
-o shared-object-name<br />
2409A055<br />
where<br />
Syntax Element<br />
cc<br />
-dy<br />
Description<br />
Invokes the MetaWare High C Compiler<br />
Specifies to use dynamic linking<br />
-G Specifies to create a shared object<br />
sourcefile<br />
Is a C source module for the INMOD<br />
-o Specifies the output file name<br />
shared-objectname<br />
Specifies the resulting shared object module<br />
This is the name specified:<br />
• The INMOD modulename parameter of the IMPORT command of the<br />
<strong>Teradata</strong> T<strong>Pump</strong> job script.<br />
• The EXIT name parameter for the NOTIFY option of the BEGIN LOAD<br />
command of the <strong>Teradata</strong> T<strong>Pump</strong> job script.<br />
The shared-object-name can be any valid UNIX file name.<br />
220 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 5: Using INMOD and Notify Exit Routines<br />
Programming INMODs for UNIX-based Clients<br />
Compiling and Linking a C INMOD on HP-UX PA RISC<br />
Use the following syntax example to compile a C INMOD on HP-UX PA RISC client.<br />
Compile Syntax<br />
cc -Aa -D_HPUX_SOURCE +z +u1 -c sourcefile.c<br />
3021B002<br />
where<br />
Syntax Element<br />
-Aa<br />
-<br />
D_HPUX_SOU<br />
RCE<br />
cc<br />
Description<br />
Option that enables the compiler to conform to ANSI standards<br />
Enables the compiler to access macros and typedefs that are not defined by the<br />
HPUX Operating System, but not the ANSI standard.<br />
Invokes the MetaWare High C Compiler<br />
+z Is a compiler option specified to generate Position Independent Code (PIC) for<br />
all user exit routines<br />
+u1 Is a compiler option that allows pointers to access non-natively aligned data<br />
sourcefile<br />
UNIX file name(s) of the source file(s) for the INMOD or notify exit routine<br />
Use the following syntax example to link the object modules on HP-UX PA-RISC into the<br />
shared object.<br />
Link Syntax<br />
,<br />
ld -b inmod.o -o inmod.so<br />
3021A003<br />
where<br />
Syntax Element<br />
ld<br />
Description<br />
Invokes the UNIX linker editor<br />
-b Is a linker option specified to generate a shared object file<br />
inmod.o<br />
o<br />
Is an object module derived from the compile step (see above)<br />
Specifies the output filename; default is a.out<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 221
Chapter 5: Using INMOD and Notify Exit Routines<br />
Programming INMODs for UNIX-based Clients<br />
Syntax Element<br />
inmod.so<br />
Description<br />
Specifies the resulting shared object module<br />
This is the user-specified name in the IMPORT command.<br />
Compiling and Linking a C INMOD on HP-UX Itanium<br />
Use the following syntax example to compile a C INMOD on an HP-UX Itanium-based client.<br />
Compile Syntax<br />
cc +u1 -D_REENTRANT +DD64 -c<br />
inmod.c<br />
2409A057<br />
where<br />
Syntax Element<br />
cc<br />
Description<br />
Invokes the MetaWare High C compiler<br />
+u1 Is a compiler option that allows pointers to access non-natively aligned data<br />
-D_REENTRANT<br />
+DD64<br />
Ensures that all the Pthread definitions are visible at compile time<br />
Generates 64-bit object code for PA2.0 architecture<br />
-c Compiles one or more source files but does not enter the linking phase<br />
inmod.c<br />
A C source module for the INMOD<br />
Use the following syntax example to link the object modules on HP-UX Itanium into the<br />
shared object.<br />
Link Syntax<br />
ld -n -b inmod.o -lc -o<br />
inmod.so<br />
2409A056<br />
where<br />
Syntax Element<br />
ld<br />
Description<br />
Invokes the UNIX linker editor<br />
222 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 5: Using INMOD and Notify Exit Routines<br />
Programming INMODs for UNIX-based Clients<br />
Syntax Element<br />
Description<br />
-n Generates an executable with file type SHARE_MAGIC. This option is ignored<br />
in 64-bit mode.<br />
-b Is a linker option specified to generate a shared object file<br />
inmod.o<br />
-lc<br />
Is an object module derived from the compile step (see above)<br />
Search a library libc.a, libc.so, or libc.sh<br />
-o Specifies the output filename; default is a.out<br />
inmod.so<br />
Specifies the resulting shared object module<br />
This is the user-specified name in the IMPORT command.<br />
Note: Object modules can be linked into shared objects or shared libraries (i.e.,<br />
.so or .sl extension respectively) on HP-UX Itanium.<br />
Compiling and Linking a C INMOD on IBM AIX<br />
Use the following syntax example to compile a C INMOD on an IBM AIX-based client.<br />
Compile Syntax<br />
cc -qmkshrobj -o shared-object-name -sourcefile.c<br />
2409C008<br />
where<br />
Syntax Element<br />
cc<br />
--qmkshrobj<br />
Description<br />
Call to the program that invokes the native UNIX C compiler<br />
Creates a shared object from the generated object files<br />
-o Switches to the linker<br />
shared-objectname<br />
sourcefile<br />
Name of the shared object file The shared-object-name can be any valid file<br />
name. This is the INMOD modulename parameter of the IMPORT of the<br />
MultiLoad job script.<br />
UNIX file name(s) of the source file(s) for the INMOD<br />
Compiling and Linking a Notify Exit Routine on IBM AIX<br />
Use the following syntax example to compile a Notify Exit Routine on an IBM AIX-based<br />
client.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 223
Chapter 5: Using INMOD and Notify Exit Routines<br />
Programming INMODs for UNIX-based Clients<br />
Compile Syntax<br />
cc -c -brtl -fPIC sourcefile.c<br />
3021A008<br />
where<br />
Syntax Element<br />
cc<br />
Description<br />
Is a call to the program that invokes the native UNIX C compiler<br />
-c Is a compiler option that specifies to not send object files to the linkage editor<br />
-brtl<br />
-fPIC<br />
sourcefile.c<br />
Tells the linkage editor to accept both .sl and .a library file types<br />
Is a compiler option that generates Position Independent Code (PIC) for all user<br />
exit routines<br />
Is a C source module for the [Notify Exit Routine.<br />
Use the following syntax example to link the object modules into a shared object module.<br />
Link Syntax<br />
ld -G -e_dynamn -bE: export_dynamn.txt<br />
A<br />
A<br />
objectfile.o -o shared-object-name -lm -lc<br />
3021A011<br />
where<br />
Syntax Element<br />
ld<br />
G<br />
-e_dynamn<br />
-bE : export_dynamn.txt<br />
objectfile.o<br />
Description<br />
Invokes the UNIX linker editor<br />
Produces a shared object enabled for use with the run-time linker<br />
Sets the entry point of the exit routine to _dynamn<br />
Is a linker option that exports the symbol "_dynamn" explicitly and<br />
the file export_dynamn.txt contains the symbol<br />
Is an object module created during compile step<br />
224 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 5: Using INMOD and Notify Exit Routines<br />
Programming INMODs for UNIX-based Clients<br />
Syntax Element<br />
Description<br />
-o Specifies the output file name<br />
shared-object-name<br />
-lm<br />
-lc<br />
Specifies the resulting shared object module<br />
This is the EXIT name parameter for the NOTIFY option of the<br />
BEGIN LOAD command of the <strong>Teradata</strong> T<strong>Pump</strong> job script.<br />
Is a linker option specifying to link with the /lib/libm.a library<br />
Is a linker option specifying to link with the /lib/libc.a library<br />
Compiling and Linking a C INMOD on a Linux Client<br />
Use the following syntax example to compile a C INMOD on a Linux client.<br />
Note: Be sure to compile the INMOD and notify exit routines in 32-bit mode so that they are<br />
compatible with <strong>Teradata</strong> T<strong>Pump</strong>.<br />
gcc<br />
-I/usr/include -shared -fPIC<br />
-m32<br />
sourcefile.c<br />
-o shared-object-name<br />
2409B023<br />
where<br />
Syntax Element<br />
gcc<br />
shared<br />
Description<br />
Invokes the C compiler on Linux<br />
Produces a shared object, which can then be linked with other objects to form an<br />
executable<br />
-m32 Generate code for a 32-bit environment. The 32-bit environment sets int, long<br />
and pointer to 32 bits.<br />
-fPIC<br />
Produces Position Independent Code<br />
-o Specifies the output file name<br />
Compiling and Linking a C INMOD on a z/Linux Client<br />
Use the following syntax example to compile a C INMOD on a z/Linux client.<br />
Note: Be sure to compile the INMOD and notify exit routines in 32-bit mode so that they are<br />
compatible with <strong>Teradata</strong> T<strong>Pump</strong>.<br />
gcc -I/usr/include -m31 -shared -fPIC sourcefile.c -o shared-object-name<br />
2409A059<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 225
Chapter 5: Using INMOD and Notify Exit Routines<br />
Programming INMODs for UNIX-based Clients<br />
where<br />
Syntax Element<br />
gcc<br />
Description<br />
Call to the program that invokes the native C compiler<br />
-m31 Generates code for a 32-bit environment.<br />
-shared<br />
-fPIC<br />
shared-objectname<br />
Flag that produces a shared object that can then be linked with other objects to<br />
form an executable<br />
Compiler option that generates Position Independent Code for all user exit<br />
routines<br />
Name of the shared object file. The shared-object-name can be any valid file<br />
name. This is the name specified as:<br />
• The INMOD modulename parameter of the IMPORT of the MultiLoad job<br />
script.<br />
• The EXIT name parameter for the NOTIFY option of the BEGIN MLOAD<br />
and BEGIN DELETE MLOAD of the MultiLoad job script.<br />
-o Output file name<br />
Compiling and Linking a C INMOD on on IBM OS z/OS<br />
Use the following syntax from the USS environment to compile and link source files to a DLL:<br />
Note: Be sure to compile the INMOD and notify exit routines in 32-bit mode so that they are<br />
compatible with <strong>Teradata</strong> T<strong>Pump</strong>.<br />
cc<br />
-o<br />
"MVS.PDSE.LOAD(module_name)"<br />
"//MVS.PDSE.C(source_name.c)" -W c,dll,expo = -W l,dll<br />
2409A058<br />
where<br />
Syntax Element<br />
Description<br />
-o Name of the executable load module that is produced during the link-edit phase.<br />
In the following example, a load module INMOD is placed in a z/OS PDSE<br />
named PDSE.LOAD, and the source code, INMOD, is compiled as a member of<br />
a z/OS PDSE named TEST.C:<br />
cc -o "//PDSE.LOAD(INMOD)" "//TEST.C(INMOD)" -W<br />
c,dll,expo -W l,dll<br />
Member names are limited to eight characters.<br />
-W c,dll,expo Options passed to the compiler phase to indicate that the source is to be<br />
compiled as a dll with all functions exported.<br />
-W l,dll Options passed to the link-edit phase to indicate that the module is linked as a dll.<br />
226 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Chapter 5: Using INMOD and Notify Exit Routines<br />
Programming INMODs for a Windows Client<br />
Programming INMODs for a Windows Client<br />
The previous section lists INMOD preparation techniques that apply to all platforms. There<br />
are several additional rules to follow when developing C INMODs for Windows clients. These<br />
are:<br />
• The INMOD routine must be written in C<br />
• The INMOD routine must have an entry point named _dynamn and declared with<br />
_declspec keyword<br />
• The file must be saved as a DLL file<br />
Compiling and Linking a C INMOD on a Windows Client<br />
Use the following syntax example to create a DLL on a Windows client.<br />
cl /DWIN32 / LD inmod.c<br />
3021B012<br />
where<br />
Syntax Element<br />
cl<br />
D<br />
LD<br />
inmod.c<br />
Description<br />
Invokes the Microsoft C Compiler<br />
Defines a macro<br />
Creates a .dll<br />
Denotes a C source module for the INMOD<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 227
Chapter 5: Using INMOD and Notify Exit Routines<br />
Programming INMODs for a Windows Client<br />
228 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
APPENDIX A<br />
How to Read Syntax Diagrams<br />
This appendix describes the conventions that apply to reading the syntax diagrams used in<br />
this book.<br />
Syntax Diagram Conventions<br />
Notation Conventions<br />
Item<br />
Definition / Comments<br />
Letter An uppercase or lowercase alphabetic character ranging from A through Z.<br />
Number A digit ranging from 0 through 9.<br />
Do not use commas when typing a number with more than 3 digits.<br />
Word<br />
Spaces<br />
Punctuation<br />
Variables and reserved words.<br />
• UPPERCASE LETTERS represent a keyword.<br />
Syntax diagrams show all keywords in uppercase, unless operating system<br />
restrictions require them to be in lowercase.<br />
• lowercase letters represent a keyword that you must type in lowercase, such as a<br />
UNIX command.<br />
• lowercase italic letters represent a variable such as a column or table name.<br />
Substitute the variable with a proper value.<br />
• lowercase bold letters represent a variable that is defined immediately<br />
following the diagram that contains the variable.<br />
• UNDERLINED LETTERS represent the default value.<br />
This applies to both uppercase and lowercase words.<br />
Use one space between items such as keywords or variables.<br />
Type all punctuation exactly as it appears in the diagram.<br />
Paths<br />
The main path along the syntax diagram begins at the left with a keyword, and proceeds, left<br />
to right, to the vertical bar, which marks the end of the diagram. Paths that do not have an<br />
arrow or a vertical bar only show portions of the syntax.<br />
The only part of a path that reads from right to left is a loop.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 229
Appendix A: How to Read Syntax Diagrams<br />
Syntax Diagram Conventions<br />
Continuation Links<br />
Paths that are too long for one line use continuation links. Continuation links are circled<br />
letters indicating the beginning and end of a link:<br />
A<br />
A<br />
Required Entries<br />
When you see a circled letter in a syntax diagram, go to the corresponding circled letter and<br />
continue reading.<br />
Required entries appear on the main path:<br />
FE0CA002<br />
SHOW<br />
FE0CA003<br />
If you can choose from more than one entry, the choices appear vertically, in a stack. The first<br />
entry appears on the main path:<br />
SHOW<br />
CONTROLS<br />
VERSIONS<br />
FE0CA005<br />
Optional Entries<br />
You may choose to include or disregard optional entries. Optional entries appear below the<br />
main path:<br />
SHOW<br />
CONTROLS<br />
FE0CA004<br />
If you can optionally choose from more than one entry, all the choices appear below the main<br />
path:<br />
230 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Appendix A: How to Read Syntax Diagrams<br />
Syntax Diagram Conventions<br />
READ<br />
SHARE<br />
ACCESS<br />
JC01A010<br />
Some commands and statements treat one of the optional choices as a default value. This<br />
value is UNDERLINED. It is presumed to be selected if you type the command or statement<br />
without specifying one of the options.<br />
Strings<br />
Strings appear in single quotes:<br />
'msgtext'<br />
JC01A004<br />
If the string text includes a single quote or a blank space, the string appears in double quotes:<br />
''abc'd"<br />
''abc d"<br />
JC01A005<br />
Abbreviations<br />
If a keyword or a reserved word has a valid abbreviation, the unabbreviated form always<br />
appears on the main path. The shortest valid abbreviation appears beneath.<br />
SHOW<br />
CONTROLS<br />
CONTROL<br />
FE0CA042<br />
In the above syntax, the following formats are valid:<br />
• SHOW CONTROLS<br />
• SHOW CONTROL<br />
Loops<br />
A loop is an entry or a group of entries that you can repeat one or more times. Syntax<br />
diagrams show loops as a return path above the main path, over the item or items that you can<br />
repeat:<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 231
Appendix A: How to Read Syntax Diagrams<br />
Syntax Diagram Conventions<br />
, 3<br />
, 4<br />
(<br />
cname )<br />
JC01B012<br />
Read loops from right to left.<br />
The following conventions apply to loops:<br />
Loop Convention<br />
A maximum number of entries is<br />
allowed.<br />
A minimum number of entries is<br />
required.<br />
A separator character is required<br />
between entries.<br />
A delimiter character is required<br />
around entries.<br />
Description<br />
The number appears in a circle on the return path.<br />
In the example, you may type cname a maximum of 4 times.<br />
The number appears in a square on the return path.<br />
In the example, you must type at least three groups of column<br />
names.<br />
The character appears on the return path.<br />
If the diagram does not show a separator character, use one<br />
blank space.<br />
In the example, the separator character is a comma.<br />
The beginning and end characters appear outside the return<br />
path.<br />
Generally, a space is not needed between delimiter characters<br />
and entries.<br />
In the example, the delimiter characters are the left and right<br />
parentheses.<br />
Excerpts<br />
Sometimes a piece of a syntax phrase is too large to fit into the diagram. Such a phrase is<br />
indicated by a break in the path, marked by (|) terminators on either side of the break. The<br />
name for the excerpted piece appears between the terminators in boldface type.<br />
232 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Appendix A: How to Read Syntax Diagrams<br />
Syntax Diagram Conventions<br />
The boldface excerpt name and the excerpted phrase appears immediately after the main<br />
diagram. The excerpted phrase starts and ends with a plain horizontal line:<br />
LOCKING<br />
excerpt<br />
A<br />
A<br />
HAVING<br />
con<br />
where_cond<br />
excerpt<br />
,<br />
cname<br />
,<br />
col_pos<br />
JC01A014<br />
Multiple Legitimate Phrases<br />
In a syntax diagram, it is possible for any number of phrases to be legitimate:<br />
DATABASE<br />
TABLE<br />
VIEW<br />
dbname<br />
tname<br />
vname<br />
JC01A016<br />
In this example, any of the following phrases are legitimate:<br />
• dbname<br />
• DATABASE dbname<br />
• tname<br />
• TABLE tname<br />
• vname<br />
• VIEW vname<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 233
Appendix A: How to Read Syntax Diagrams<br />
Syntax Diagram Conventions<br />
Sample Syntax Diagram<br />
,<br />
CREATE VIEW<br />
viewname<br />
AS<br />
A<br />
CV<br />
cname<br />
LOCKING<br />
LOCK<br />
A<br />
dbname<br />
ACCESS<br />
B<br />
DATABASE<br />
FOR<br />
SHARE<br />
MODE<br />
tname<br />
IN<br />
READ<br />
TABLE<br />
WRITE<br />
vname<br />
EXCLUSIVE<br />
VIEW<br />
EXCL<br />
,<br />
,<br />
B SEL expr FROM tname<br />
qual_cond C<br />
.aname<br />
C<br />
HAVING cond ;<br />
qual_cond<br />
WHERE cond<br />
,<br />
GROUP BY<br />
cname<br />
,<br />
col_pos<br />
JC01A018<br />
Diagram Identifier<br />
The alphanumeric string that appears in the lower right corner of every diagram is an internal<br />
identifier used to catalog the diagram. The text never refers to this string.<br />
234 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
APPENDIX B<br />
<strong>Teradata</strong> T<strong>Pump</strong> Examples<br />
This appendix provides some examples of <strong>Teradata</strong> T<strong>Pump</strong> scripts and their corresponding<br />
output. Included are:<br />
• Simple Script Example<br />
• Restarted Upsert Example<br />
• Example Using the TABLE Command<br />
In the output examples, the lines that begin with 4-digit numbers (for example, 0001) are<br />
scripts, the rest are output.<br />
Simple Script Example<br />
The following is an example of a simple script.<br />
/***********************************************/<br />
/* Script Name: TP0623 */<br />
/* Description: WIN32 script. */<br />
/***********************************************/<br />
.LOGTABLE TPLOG0623;<br />
.LOGON HYIBMX01/BRUCEDB,BRUCE;<br />
DROP TABLE TPTBL0623;<br />
DROP TABLE TPERR0623;<br />
/***********************************************/<br />
/* STEP01 CREATES THE TABLES FOR THE T<strong>Pump</strong> JOB */<br />
/***********************************************/<br />
CREATE TABLE TPTBL0623, FALLBACK(<br />
F1 INTEGER,F2 CHAR(50),<br />
F3 VARCHAR(50),F4 FLOAT,<br />
F5 BYTE (10),F6 VARBYTE (10),<br />
F7 DECIMAL(8,2),F8 BYTEINT,<br />
F9 SMALLINT,F10 DATE,<br />
F11 BIGINT,F12 DECIMAL(38,0))<br />
UNIQUE PRIMARY INDEX (F1);<br />
/***********************************************/<br />
/* BEGIN LOAD WITH ALL THE OPTIONS SPECIFIED */<br />
/* SUCH AS ERRLIMIT, CHECKPOINT, SESSIONS, */<br />
/* TENACITY, etc. */<br />
/***********************************************/<br />
.BEGIN LOADCHECKPOINT 15SESSIONS 4 1<br />
TENACITY 2ERRORTABLE TPERR0623<br />
ERRLIMIT 10ROBUST OFF<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 235
Appendix B: <strong>Teradata</strong> T<strong>Pump</strong> Examples<br />
Simple Script Example<br />
PACK 500DATAENCRYPTION ON<br />
ARRAYSUPPORT ON RATE 200<br />
RETRYTIMES 200 SLEEP 40<br />
NOATOMICUPSERT MACRODB BRUCEDB<br />
NOTIFY OFFSERIALIZE ON;<br />
.LAYOUT LAY0623;<br />
.FIELD FF1 * INTEGER KEY;<br />
.FIELD FF2 * CHAR(50);<br />
.FIELD FF3 * VARCHAR(50);<br />
.FIELD FF4 * FLOAT;<br />
.FIELD FF5 * BYTE(10);<br />
.FIELD FF6 * VARBYTE(10);<br />
.FIELD FF7 * DECIMAL(8,2);<br />
.FIELD FF8 * BYTEINT;<br />
.FIELD FF9 * SMALLINT;<br />
.FIELD FF10 * DATE;<br />
.FIELD FF11 * BIGINT;<br />
.FIELD FF12 * DECIMAL(38,0);<br />
.DML LABEL LABEL0623IGNORE DUPLICATE ROWS<br />
IGNORE MISSING ROWS<br />
IGNORE EXTRA ROWS;<br />
INSERT INTO TPTBL0623 VALUES (:FF1,:FF2,:FF3,:FF4,<br />
:FF5,:FF6,:FF7,:FF8,<br />
:FF9,:FF10,:FF11,:FF12);<br />
.IMPORT INFILE ./ALLTYPE.data<br />
LAYOUT LAY0623<br />
APPLY LABEL0623;<br />
.END LOAD;<br />
.LOGOFF;<br />
produces the following output:<br />
**** 15:17:25 UTY6633 WARNING: No configuration file, using build defaults<br />
========================================================================<br />
= =<br />
= <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Utility Release 13.10.00.000 =<br />
= Platform WIN32 =<br />
= =<br />
========================================================================<br />
= =<br />
= Copyright 1997-2009 <strong>Teradata</strong> Corporation. ALL RIGHTS RESERVED. =<br />
= =<br />
========================================================================<br />
**** 15:17:25 UTY2411 Processing start date: TUE OCT 06, 2009<br />
========================================================================<br />
= =<br />
= Logon/Connection =<br />
= =<br />
========================================================================<br />
0001 /***********************************************/<br />
/* Script Name: TP0623 */<br />
/* Description: WIN32 script. */<br />
/***********************************************/<br />
.LOGTABLE TPLOG0623;<br />
0002 .LOGON HYIBMX01/BRUCEDB,;<br />
**** 15:17:29 UTY8400 <strong>Teradata</strong> <strong>Data</strong>base Release:13.10g.00.53<br />
**** 15:17:29 UTY8400 <strong>Teradata</strong> <strong>Data</strong>base Version: 13.10g.00.53<br />
**** 15:17:29 UTY8400 Default character set: ASCII<br />
**** 15:17:29 UTY8400 Current RDBMS has UDT support<br />
236 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Appendix B: <strong>Teradata</strong> T<strong>Pump</strong> Examples<br />
Simple Script Example<br />
**** 15:17:29 UTY8400 Maximum supported buffer size: 1M<br />
**** 15:17:29 UTY8400 Upsert supported by RDBMS server<br />
**** 15:17:29 UTY8400 <strong>Data</strong> Encryption supported by RDBMS server<br />
**** 15:17:29 UTY8400 Array Support supported by RDBMS server<br />
**** 15:17:32 UTY6211 A successful connect was made to the RDBMS.<br />
**** 15:17:32 UTY6217 Logtable 'BRUCEDB.TPLOG0623' has been created.<br />
========================================================================<br />
= =<br />
= Processing Control Statements =<br />
= =<br />
========================================================================<br />
0003 DROP TABLE TPTBL0623;<br />
**** 15:17:35 UTY1016 'DROP' request successful.<br />
0004 DROP TABLE TPERR0623;<br />
**** 15:17:37 UTY1008 RDBMS failure: 3807, Object 'TPERR0623' does not exist.<br />
0005 /***********************************************/<br />
/* STEP01 CREATES THE TABLES FOR THE T<strong>Pump</strong> JOB */<br />
/***********************************************/<br />
CREATE TABLE TPTBL0623, FALLBACK(<br />
F1 INTEGER, F2 CHAR(50),<br />
F3 VARCHAR(50), F4 FLOAT,<br />
F5 BYTE (10), F6 VARBYTE (10),<br />
F7 DECIMAL(8,2),F8 BYTEINT,<br />
F9 SMALLINT, F10 DATE,<br />
F11 BIGINT, F12 DECIMAL(38,0))<br />
UNIQUE PRIMARY INDEX (F1);<br />
**** 15:17:39 UTY1016 'CREATE' request successful.<br />
0006 /***********************************************/<br />
/* BEGIN LOAD WITH ALL THE OPTIONS SPECIFIED */<br />
/* SUCH AS ERRLIMIT, CHECKPOINT, SESSIONS, */<br />
/* TENACITY, etc. */<br />
/***********************************************/<br />
.BEGIN LOAD CHECKPOINT 15 SESSIONS 4 1<br />
TENACITY 2 ERRORTABLE TPERR0623<br />
ERRLIMIT 10 ROBUST OFF<br />
PACK 500 DATAENCRYPTION ON<br />
ARRAYSUPPORT ON RATE 200<br />
RETRYTIMES 200 SLEEP 40<br />
NOATOMICUPSERT MACRODB BRUCEDB<br />
NOTIFY OFF SERIALIZE ON;<br />
========================================================================<br />
= =<br />
= Processing T<strong>Pump</strong> Statements =<br />
= =<br />
========================================================================<br />
0007 .LAYOUT LAY0623;<br />
0008 .FIELD FF1 * INTEGER KEY;<br />
0009 .FIELD FF2 * CHAR(50);<br />
0010 .FIELD FF3 * VARCHAR(50);<br />
0011 .FIELD FF4 * FLOAT;<br />
0012 .FIELD FF5 * BYTE(10);<br />
0013 .FIELD FF6 * VARBYTE(10);<br />
0014 .FIELD FF7 * DECIMAL(8,2);<br />
0015 .FIELD FF8 * BYTEINT;<br />
0016 .FIELD FF9 * SMALLINT;<br />
0017 .FIELD FF10 * DATE;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 237
Appendix B: <strong>Teradata</strong> T<strong>Pump</strong> Examples<br />
Simple Script Example<br />
0018 .FIELD FF11 * BIGINT;<br />
0019 .FIELD FF12 * DECIMAL(38,0);<br />
0020 .DML LABEL LABEL0623 IGNORE DUPLICATE ROWS<br />
IGNORE MISSING ROWS<br />
IGNORE EXTRA ROWS;<br />
0021 INSERT INTO TPTBL0623 VALUES ( :FF1, :FF2, :FF3, :FF4,<br />
:FF5, :FF6, :FF7, :FF8,<br />
:FF9, :FF10, :FF11, :FF12);<br />
0022 .IMPORT INFILE ./ALLTYPE.data<br />
LAYOUT LAY0623<br />
APPLY LABEL0623;<br />
0023 .END LOAD;<br />
**** 15:17:39 UTY6609 Starting to log on sessions...<br />
**** 15:17:44 UTY6610 Logged on 3 sessions.<br />
========================================================================<br />
= =<br />
= T<strong>Pump</strong> Import(s) Beginning =<br />
= =<br />
========================================================================<br />
**** 15:17:44 UTY6630 Options in effect for following T<strong>Pump</strong> Import(s):<br />
. Tenacity: 2 hour limit to successfully connect load sessions.<br />
. Max Sessions: 4 session(s).<br />
. Min Sessions: 1 session(s).<br />
. Checkpoint: 15 minute(s).<br />
. Errlimit: 10 rejected record(s).<br />
. Restart Mode: SIMPLE.<br />
. Serialization: ON.<br />
. Packing: 500 Statements per Request.<br />
. StartUp Rate: 200 Statements per Minute.<br />
.Rate Per Period: 50 Statements per 15000 milliseconds.<br />
. Atomic Upsert: DISABLED.<br />
**** 15:17:50 UTY6608 Import 1 begins.<br />
**** 15:22:51 UTY6641 Since last chkpt., 1000 recs. in, 1000 stmts., 24 reqs<br />
**** 15:22:51 UTY6647 Since last chkpt., avg. DBS wait time: 0.42<br />
**** 15:22:51 UTY6612 Beginning final checkpoint...<br />
**** 15:22:51 UTY6641 Since last chkpt., 1000 recs. in, 1000 stmts., 24 reqs<br />
**** 15:22:51 UTY6647 Since last chkpt., avg. DBS wait time: 0.42<br />
**** 15:22:52 UTY6607 Checkpoint Completes with 1000 rows sent.<br />
**** 15:22:52 UTY6642 Import 1 statements: 1000, requests: 24<br />
**** 15:22:52 UTY6643 Import 1 average statements per request: 41.67<br />
**** 15:22:52 UTY6644 Import 1 average statements per record: 1.00<br />
**** 15:22:52 UTY6645 Import 1 statements/session: avg. 333.33, min. 333.00, max. 334.00<br />
**** 15:22:52 UTY6646 Import 1 requests/session: average 8.00, minimum 8.00, maximum 8.00<br />
**** 15:22:52 UTY6648 Import 1 DBS wait time/session: avg. 3.33, min. 2.00, max. 4.00<br />
**** 15:22:52 UTY6649 Import 1 DBS wait time/request: avg. 0.42, min. 0.25, max. 0.50<br />
**** 15:22:52 UTY1803 Import processing statistics<br />
. IMPORT 1 Total thus far<br />
. ========= ==============<br />
Candidate records considered:........ 1000....... 1000<br />
Apply conditions satisfied:.......... 1000....... 1000<br />
Records logable to error table:...... 0....... 0<br />
Candidate records rejected:.......... 0....... 0<br />
** Statistics for Apply Label : LABEL0623<br />
Type <strong>Data</strong>base Table or Macro Name Activity<br />
I BRUCEDB TPTBL0623 1000<br />
**** 15:22:54 UTY0821 Error table BRUCEDB.TPERR0623 is EMPTY, dropping table.<br />
0024 .LOGOFF;<br />
========================================================================<br />
= =<br />
238 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Appendix B: <strong>Teradata</strong> T<strong>Pump</strong> Examples<br />
Restarted Upsert Example<br />
= Logoff/Disconnect =<br />
= =<br />
========================================================================<br />
**** 15:22:58 UTY6216 The restart log table has been dropped.<br />
**** 15:22:59 UTY6212 A successful disconnect was made from the RDBMS.<br />
**** 15:22:59 UTY2410 Total processor time used = '0.21875 Seconds'<br />
. Start : 15:17:25 - TUE OCT 06, 2009<br />
. End : 15:22:59 - TUE OCT 06, 2009<br />
. Highest return code encountered = '0'.<br />
Restarted Upsert Example<br />
This restarted upsert example uses two IMPORT clauses. The first one loads half of the<br />
records from the data source into an empty table. The second one does an upsert using all the<br />
records in the same data file. The result is that it updates the rows inserted during the first<br />
import and inserts all of the rows that the first import skipped.<br />
This script:<br />
/***********************************************/<br />
/* Script Name: TP0734 */<br />
/* Description: WIN32 script. */<br />
/***********************************************/<br />
.LOGTABLE TPLOG0734;<br />
.LOGON ESIBMX01/LYDIADB,LYDIA;<br />
DROP TABLE TPTBL0734;<br />
DROP TABLE TPERR0734;<br />
/***********************************************/<br />
/* STEP01 CREATES THE TABLES FOR THE T<strong>Pump</strong> JOB */<br />
/***********************************************/<br />
CREATE TABLE TPTBL0734, FALLBACK(<br />
F1 INTEGER,F2 CHAR(50),<br />
F3 VARCHAR(50),F4 FLOAT,<br />
F5 BYTE (10),F6 VARBYTE (10),<br />
F7 DECIMAL(8,2),F8 BYTEINT,<br />
F9 SMALLINT,F10 DATE,<br />
F11 BIGINT,F12 DECIMAL(38,0))<br />
UNIQUE PRIMARY INDEX (F1);<br />
/***********************************************/<br />
/* BEGIN LOAD WITH ALL THE OPTIONS SPECIFIED */<br />
/* SUCH AS ERRLIMIT, CHECKPOINT, SESSIONS, */<br />
/* TENACITY, etc. */<br />
/***********************************************/<br />
.BEGIN LOADCHECKPOINT 15SESSIONS 4 1<br />
SERIALIZE ONERRORTABLE TPERR0734;<br />
.LAYOUT LAY0734;<br />
.FIELD FF1 * INTEGER KEY;<br />
.FIELD FF2 * CHAR(50);<br />
.FIELD FF3 * VARCHAR(50);<br />
.FIELD FF4 * FLOAT;<br />
.FIELD FF5 * BYTE(10);<br />
.FIELD FF6 * VARBYTE(10);<br />
.FIELD FF7 * DECIMAL(8,2);<br />
.FIELD FF8 * BYTEINT;<br />
.FIELD FF9 * SMALLINT;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 239
Appendix B: <strong>Teradata</strong> T<strong>Pump</strong> Examples<br />
Restarted Upsert Example<br />
.FIELD FF10 * DATE;<br />
.FIELD FF11 * BIGINT;<br />
.FIELD FF12 * DECIMAL(38,0);<br />
/* insert half of the rows ......................*/<br />
.DML LABEL LABEL0734AIGNORE DUPLICATE ROWS<br />
IGNORE MISSING ROWS<br />
IGNORE EXTRA ROWS;<br />
INSERT INTO TPTBL0734 VALUES (:FF1,:FF2,:FF3,:FF4,<br />
:FF5,:FF6,:FF7,:FF8,<br />
:FF9,:FF10,:FF11,:FF12);<br />
/* ... and then upsert all of the rows ..........*/<br />
.DML LABEL LABEL0734BIGNORE DUPLICATE ROWS<br />
IGNORE MISSING ROWS<br />
IGNORE EXTRA ROWS<br />
DO INSERT FOR MISSING UPDATE ROWS;<br />
UPDATE TPTBL0734 SET F7 = F7 + 1 WHERE F1 = :FF1;<br />
INSERT INTO TPTBL0734 VALUES (:FF1,:FF2,:FF3,:FF4,<br />
:FF5,:FF6,:FF7,:FF8,<br />
:FF9,:FF10,:FF11,:FF12);<br />
/* should result in an upsert with half inserts and half updates */<br />
.IMPORT INFILE ./ALLTYPE.data<br />
LAYOUT LAY0734 FROM 1 FOR 400<br />
APPLY LABEL0734A WHERE FF3 = 'TERADATA';<br />
.IMPORT INFILE ./ALLTYPE.data<br />
LAYOUT LAY0734 FROM 1 FOR 400<br />
APPLY LABEL0734B;<br />
.END LOAD;<br />
.LOGOFF;<br />
produces the following output (assuming it was restarted during the second import):<br />
0001 /***********************************************/<br />
/* Script Name: TP0734 */<br />
/* Description: WIN32 script. */<br />
/***********************************************/<br />
.LOGTABLE TPLOG0734;<br />
0002 .LOGON ESIBMX01/LYDIADB,;<br />
**** 16:51:58 UTY8400 <strong>Teradata</strong> <strong>Data</strong>base Release: 13.10g.00.53<br />
**** 16:51:58 UTY8400 <strong>Teradata</strong> <strong>Data</strong>base Version: 13.10g.00.53<br />
**** 16:51:58 UTY8400 Default character set: ASCII<br />
**** 16:51:58 UTY8400 Current RDBMS has UDT support<br />
**** 16:51:58 UTY8400 Maximum supported buffer size: 1M<br />
**** 16:51:58 UTY8400 Upsert supported by RDBMS server<br />
**** 16:51:58 UTY8400 <strong>Data</strong> Encryption supported by RDBMS server<br />
**** 16:51:58 UTY8400 Array Support supported by RDBMS server<br />
**** 16:52:00 UTY6211 A successful connect was made to the RDBMS.<br />
**** 16:52:00 UTY6217 Logtable 'LYDIADB.TPLOG0734' has been created.<br />
========================================================================<br />
= =<br />
= Processing Control Statements =<br />
= =<br />
========================================================================<br />
0003 DROP TABLE TPTBL0734;<br />
**** 16:52:02 UTY1016 'DROP' request successful.<br />
0004 DROP TABLE TPERR0734;<br />
**** 16:52:03 UTY1008 RDBMS failure: 3807, Object 'TPERR0734' does not exist.<br />
0005 /***********************************************/<br />
/* STEP01 CREATES THE TABLES FOR THE T<strong>Pump</strong> JOB */<br />
/***********************************************/<br />
240 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Appendix B: <strong>Teradata</strong> T<strong>Pump</strong> Examples<br />
Restarted Upsert Example<br />
CREATE TABLE TPTBL0734, FALLBACK(<br />
F1 INTEGER, F2 CHAR(50),<br />
F3 VARCHAR(50), F4 FLOAT,<br />
F5 BYTE (10), F6 VARBYTE (10),<br />
F7 DECIMAL(8,2),F8 BYTEINT,<br />
F9 SMALLINT, F10 DATE,<br />
F11 BIGINT, F12 DECIMAL(38,0))<br />
UNIQUE PRIMARY INDEX (F1);<br />
**** 16:52:06 UTY1016 'CREATE' request successful.<br />
0006 /***********************************************/<br />
/* BEGIN LOAD WITH ALL THE OPTIONS SPECIFIED */<br />
/* SUCH AS ERRLIMIT, CHECKPOINT, SESSIONS, */<br />
/* TENACITY, etc. */<br />
/***********************************************/<br />
.BEGIN LOAD CHECKPOINT 15 SESSIONS 4 1<br />
SERIALIZE ON ERRORTABLE TPERR0734;<br />
========================================================================<br />
= =<br />
= Processing T<strong>Pump</strong> Statements =<br />
= =<br />
========================================================================<br />
0007 .LAYOUT LAY0734;<br />
0008 .FIELD FF1 * INTEGER KEY;<br />
0009 .FIELD FF2 * CHAR(50);<br />
0010 .FIELD FF3 * VARCHAR(50);<br />
0011 .FIELD FF4 * FLOAT;<br />
0012 .FIELD FF5 * BYTE(10);<br />
0013 .FIELD FF6 * VARBYTE(10);<br />
0014 .FIELD FF7 * DECIMAL(8,2);<br />
0015 .FIELD FF8 * BYTEINT;<br />
0016 .FIELD FF9 * SMALLINT;<br />
0017 .FIELD FF10 * DATE;<br />
0018 .FIELD FF11 * BIGINT;<br />
0019 .FIELD FF12 * DECIMAL(38,0);<br />
0020 /* insert half of the rows ......................*/<br />
.DML LABEL LABEL0734A IGNORE DUPLICATE ROWS<br />
IGNORE MISSING ROWS<br />
IGNORE EXTRA ROWS;<br />
0021 INSERT INTO TPTBL0734 VALUES ( :FF1, :FF2, :FF3, :FF4,<br />
:FF5, :FF6, :FF7, :FF8,<br />
:FF9, :FF10, :FF11, :FF12);<br />
0022 /* ... and then upsert all of the rows ..........*/<br />
.DML LABEL LABEL0734B IGNORE DUPLICATE ROWS<br />
IGNORE MISSING ROWS<br />
IGNORE EXTRA ROWS<br />
DO INSERT FOR MISSING UPDATE ROWS;<br />
0023 UPDATE TPTBL0734 SET F7 = F7 + 1 WHERE F1 = :FF1;<br />
0024 INSERT INTO TPTBL0734 VALUES ( :FF1, :FF2, :FF3, :FF4,<br />
:FF5, :FF6, :FF7, :FF8,<br />
:FF9, :FF10, :FF11, :FF12);<br />
0025 /* should result in an upsert with half inserts and half updates */<br />
.IMPORT INFILE ./ALLTYPE.data<br />
LAYOUT LAY0734 FROM 1 FOR 400<br />
APPLY LABEL0734A WHERE FF3 = 'TERADATA';<br />
0026 .IMPORT INFILE ./ALLTYPE.data<br />
LAYOUT LAY0734 FROM 1 FOR 400<br />
APPLY LABEL0734B;<br />
0027 .END LOAD;<br />
**** 16:52:06 UTY6609 Starting to log on sessions...<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 241
Appendix B: <strong>Teradata</strong> T<strong>Pump</strong> Examples<br />
Restarted Upsert Example<br />
**** 16:52:11 UTY6610 Logged on 3 sessions.<br />
========================================================================<br />
= =<br />
= T<strong>Pump</strong> Import(s) Beginning =<br />
= =<br />
========================================================================<br />
**** 16:52:11 UTY6630 Options in effect for following T<strong>Pump</strong> Import(s):<br />
. Tenacity: 4 hour limit to successfully connect load sessions.<br />
. Max Sessions: 4 session(s).<br />
. Min Sessions: 1 session(s).<br />
. Checkpoint: 15 minute(s).<br />
. Errlimit: No limit in effect.<br />
. Restart Mode: ROBUST.<br />
. Serialization: ON.<br />
. Packing: 20 Statements per Request.<br />
. StartUp Rate: UNLIMITED Statements per Minute.<br />
**** 16:52:18 UTY6608 Import 1 begins.<br />
**** 16:52:25 UTY6641 Since last chkpt., 400 recs. in, 200 stmts., 12 reqs<br />
**** 16:52:25 UTY6647 Since last chkpt., avg. DBS wait time: 0.58<br />
**** 16:52:25 UTY6612 Beginning final checkpoint...<br />
**** 16:52:25 UTY6641 Since last chkpt., 400 recs. in, 200 stmts., 12 reqs<br />
**** 16:52:25 UTY6647 Since last chkpt., avg. DBS wait time: 0.58<br />
**** 16:52:25 UTY6607 Checkpoint Completes with 200 rows sent.<br />
**** 16:52:25 UTY6642 Import 1 statements: 200, requests: 12<br />
**** 16:52:25 UTY6643 Import 1 average statements per request: 16.67<br />
**** 16:52:25 UTY6644 Import 1 average statements per record: 1.00<br />
**** 16:52:25 UTY6645 Import 1 statements/session: avg. 66.67, min. 66.00, max. 67.00<br />
**** 16:52:25 UTY6646 Import 1 requests/session: average 4.00, minimum 4.00, maximum 4.00<br />
**** 16:52:25 UTY6648 Import 1 DBS wait time/session: avg. 2.33, min. 0.00, max. 4.00<br />
**** 16:52:25 UTY6649 Import 1 DBS wait time/request: avg. 0.58, min. 0.00, max. 1.00<br />
**** 16:52:25 UTY1803 Import processing statistics<br />
. IMPORT 1 Total thus far<br />
. ========= ==============<br />
Candidate records considered:........ 400....... 400<br />
Apply conditions satisfied:.......... 200....... 200<br />
Records logable to error table:...... 0....... 0<br />
Candidate records rejected:.......... 0....... 0<br />
** Statistics for Apply Label : LABEL0734A<br />
Type <strong>Data</strong>base Table or Macro Name Activity<br />
I LYDIADB TPTBL0734 200<br />
**** 16:52:33 UTY8800 WARNING: Rate Monitoring turned off - no permission on macro:<br />
T<strong>Pump</strong>Macro.ImportCreate.<br />
**** 16:52:33 UTY6608 Import 2 begins.<br />
**** 16:52:47 UTY6641 Since last chkpt., 400 recs. in, 400 stmts., 21 reqs<br />
**** 16:52:47 UTY6647 Since last chkpt., avg. DBS wait time: 0.67<br />
**** 16:52:47 UTY6612 Beginning final checkpoint...<br />
**** 16:52:47 UTY6641 Since last chkpt., 400 recs. in, 400 stmts., 21 reqs<br />
**** 16:52:47 UTY6647 Since last chkpt., avg. DBS wait time: 0.67<br />
**** 16:52:48 UTY6607 Checkpoint Completes with 400 rows sent.<br />
**** 16:52:48 UTY6642 Import 2 statements: 400, requests: 21<br />
**** 16:52:48 UTY6643 Import 2 average statements per request: 19.05<br />
**** 16:52:48 UTY6644 Import 2 average statements per record: 1.00<br />
**** 16:52:48 UTY6645 Import 2 statements/session: avg. 133.33, min. 133.00, max. 134.00<br />
**** 16:52:48 UTY6646 Import 2 requests/session: average 7.00, minimum 7.00, maximum 7.00<br />
**** 16:52:48 UTY6648 Import 2 DBS wait time/session: avg. 4.67, min. 0.00, max. 8.00<br />
**** 16:52:48 UTY6649 Import 2 DBS wait time/request: avg. 0.67, min. 0.00, max. 1.14<br />
**** 16:52:48 UTY1803 Import processing statistics<br />
. IMPORT 2 Total thus far<br />
. ========= ==============<br />
242 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Appendix B: <strong>Teradata</strong> T<strong>Pump</strong> Examples<br />
Example Using the TABLE Command<br />
Candidate records considered:........ 400....... 800<br />
Apply conditions satisfied:.......... 400....... 600<br />
Records logable to error table:...... 0....... 0<br />
Candidate records rejected:.......... 0....... 0<br />
** Statistics for Apply Label : LABEL0734B<br />
Type <strong>Data</strong>base Table or Macro Name Activity<br />
U LYDIADB TPTBL0734 200<br />
I LYDIADB TPTBL0734 200<br />
**** 16:52:50 UTY0821 Error table LYDIADB.TPERR0734 is EMPTY, dropping table.<br />
0028 .LOGOFF;<br />
========================================================================<br />
= =<br />
= Logoff/Disconnect =<br />
= =<br />
========================================================================<br />
**** 16:52:54 UTY6216 The restart log table has been dropped.<br />
**** 16:52:55 UTY6212 A successful disconnect was made from the RDBMS.<br />
**** 16:52:55 UTY2410 Total processor time used = '0.21875 Seconds'<br />
. Start : 16:51:54 - TUE OCT 06, 2009<br />
. End : 16:52:55 - TUE OCT 06, 2009<br />
. Highest return code encountered = '0'.<br />
Example Using the TABLE Command<br />
This example script uses the TABLE command and “INSERT .*” feature.<br />
.LOGTABLE TPLOG0096;<br />
.LOGON ESSNLX14/KRCDB,KRCDB;<br />
DROP TABLE TPTBL0096;<br />
DROP TABLE TPERR0096;<br />
CREATE TABLE TPTBL0096, FALLBACK(<br />
F0 integer, F1 integer,<br />
F2 integer, F3 CHAR(38))<br />
UNIQUE PRIMARY INDEX (F0);<br />
.BEGIN LOAD SESSIONS 8;<br />
.LAYOUT LAY0096;<br />
.TABLE TPTBL0096;<br />
.DML LABEL LABEL0096 ;<br />
INSERT INTO TPTBL0096.*;<br />
.IMPORT INFILE datafile1<br />
LAYOUT LAY0096<br />
APPLY LABEL0096 FROM 1 THRU 111;<br />
.END LOAD;<br />
.LOGOFF;<br />
produces the following results. When looking at the following results, notice that the output<br />
fields generated by the TABLE command includes the “KEY” modifier for the field coming<br />
from the primary index of the table. This is what enables the use of the “SERIALIZE” option:<br />
0001 .LOGTABLE TPLOG0096;<br />
0002 .LOGON ESSNLX14/KRCDB,;<br />
**** 17:07:35 UTY8400 <strong>Teradata</strong> <strong>Data</strong>base Release: 13.10g.00.53<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 243
Appendix B: <strong>Teradata</strong> T<strong>Pump</strong> Examples<br />
Example Using the TABLE Command<br />
**** 17:07:35 UTY8400 <strong>Teradata</strong> <strong>Data</strong>base Version: 13.10g.00.53<br />
**** 17:07:35 UTY8400 Default character set: ASCII<br />
**** 17:07:35 UTY8400 Current RDBMS has UDT support<br />
**** 17:07:35 UTY8400 Maximum supported buffer size: 1M<br />
**** 17:07:35 UTY8400 Upsert supported by RDBMS server<br />
**** 17:07:35 UTY8400 <strong>Data</strong> Encryption supported by RDBMS server<br />
**** 17:07:35 UTY8400 Array Support supported by RDBMS server<br />
**** 17:07:37 UTY6211 A successful connect was made to the RDBMS.<br />
**** 17:07:37 UTY6217 Logtable KRCD.TPLOG0096' has been created.<br />
========================================================================<br />
= =<br />
= Processing Control Statements =<br />
= =<br />
========================================================================<br />
0003 DROP TABLE TPTBL0096;<br />
**** 17:07:39 UTY1016 'DROP' request successful.<br />
0004 DROP TABLE TPERR0096;<br />
**** 17:07:41 UTY1008 RDBMS failure: 3807, Object 'TPERR0096' does not exist.<br />
0005 CREATE TABLE TPTBL0096, FALLBACK(<br />
F0 integer, F1 integer,<br />
F2 integer, F3 CHAR(38))<br />
UNIQUE PRIMARY INDEX (F0);<br />
**** 17:07:43 UTY1016 'CREATE' request successful.<br />
0006 .BEGIN LOAD SESSIONS 8;<br />
========================================================================<br />
= =<br />
= Processing T<strong>Pump</strong> Statements =<br />
= =<br />
========================================================================<br />
0007 .LAYOUT LAY0096;<br />
0008 .TABLE TPTBL0096;<br />
**** 17:07:43 UTY6009 Fields generated by .TABLE command begin.<br />
**** 17:07:43 UTY6010 *** .FIELD F0 * INTEGER KEY;<br />
**** 17:07:43 UTY6010 *** .FIELD F1 * INTEGER;<br />
**** 17:07:43 UTY6010 *** .FIELD F2 * INTEGER;<br />
**** 17:07:43 UTY6010 *** .FIELD F3 * CHAR(38);<br />
**** 17:07:43 UTY6011 Fields generated by .TABLE command end.<br />
0009 .DML LABEL LABEL0096 ;<br />
0010 INSERT INTO TPTBL0096.*;<br />
0011 .IMPORT INFILE datafile1<br />
LAYOUT LAY0096<br />
APPLY LABEL0096 FROM 1 THRU 111;<br />
0012 .END LOAD;<br />
**** 17:07:44 UTY6609 Starting to log on sessions...<br />
**** 17:07:56 UTY6610 Logged on 8 sessions.<br />
========================================================================<br />
= =<br />
= T<strong>Pump</strong> Import(s) Beginning =<br />
= =<br />
========================================================================<br />
**** 17:07:56 UTY6630 Options in effect for following T<strong>Pump</strong> Import(s):<br />
. Tenacity: 4 hour limit to successfully connect load sessions.<br />
. Max Sessions: 8 session(s).<br />
. Min Sessions: 6 session(s).<br />
. Checkpoint: 15 minute(s).<br />
244 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Appendix B: <strong>Teradata</strong> T<strong>Pump</strong> Examples<br />
Example Using the TABLE Command<br />
. Errlimit: No limit in effect.<br />
. Restart Mode: ROBUST.<br />
. Serialization: OFF.<br />
. Packing: 20 Statements per Request.<br />
. StartUp Rate: UNLIMITED Statements per Minute.<br />
**** 17:08:04 UTY8800 WARNING: Rate Monitoring turned off - no permission on macro:<br />
T<strong>Pump</strong>Macro.ImportCreate.<br />
**** 17:08:04 UTY6608 Import 1 begins.<br />
**** 17:08:07 UTY6641 Since last chkpt., 111 recs. in, 111 stmts., 6 reqs<br />
**** 17:08:07 UTY6647 Since last chkpt., avg. DBS wait time: 0.50<br />
**** 17:08:07 UTY6612 Beginning final checkpoint...<br />
**** 17:08:07 UTY6641 Since last chkpt., 111 recs. in, 111 stmts., 6 reqs<br />
**** 17:08:07 UTY6647 Since last chkpt., avg. DBS wait time: 0.50<br />
**** 17:08:08 UTY6607 Checkpoint Completes with 111 rows sent.<br />
**** 17:08:08 UTY6642 Import 1 statements: 111, requests: 6<br />
**** 17:08:08 UTY6643 Import 1 average statements per request: 18.50<br />
**** 17:08:08 UTY6644 Import 1 average statements per record: 1.00<br />
**** 17:08:08 UTY6645 Import 1 statements/session: avg. 13.88, min. 0.00, max. 20.00<br />
**** 17:08:08 UTY6646 Import 1 requests/session: average 0.75, minimum 0.00, maximum 1.00<br />
**** 17:08:08 UTY6648 Import 1 DBS wait time/session: avg. 0.38, min. 0.00, max. 2.00<br />
**** 17:08:08 UTY6649 Import 1 DBS wait time/request: avg. 0.38, min. 0.00, max. 2.00<br />
**** 17:08:08 UTY1803 Import processing statistics<br />
. IMPORT 1 Total thus far<br />
. ========= ==============<br />
Candidate records considered:........ 111....... 111<br />
Apply conditions satisfied:.......... 111....... 111<br />
Records logable to error table:...... 0....... 0<br />
Candidate records rejected:.......... 0....... 0<br />
** Statistics for Apply Label : LABEL0096<br />
Type <strong>Data</strong>base Table or Macro Name Activity<br />
I KRCDB TPTBL0096 111<br />
**** 17:08:10 UTY0821 Error table KRC.M20080627_170744_00603_001_ET is EMPTY, dropping<br />
table.<br />
0013 .LOGOFF;<br />
========================================================================<br />
= =<br />
= Logoff/Disconnect =<br />
= =<br />
========================================================================<br />
**** 17:08:17 UTY6216 The restart log table has been dropped.<br />
**** 17:08:17 UTY6212 A successful disconnect was made from the RDBMS.<br />
**** 17:08:17 UTY2410 Total processor time used = '0.390625 Seconds'<br />
. Start : 17:07:30 -TUE OCT 06, 2009<br />
. End : 17:08:17 - TUE OCT 06, 2009<br />
. Highest return code encountered = '0'.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 245
Appendix B: <strong>Teradata</strong> T<strong>Pump</strong> Examples<br />
Example Using the TABLE Command<br />
246 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
APPENDIX C<br />
INMOD and Notify Exit Routine<br />
Examples<br />
This appendix provides INMOD examples using C INMOD - UNIX<br />
These examples contain z/OS control statements.<br />
Workstation-based clients support only INMODs written in C; an example of this is also<br />
provided in this appendix.<br />
C INMOD - UNIX<br />
/************************************************************************<br />
* *<br />
* TITLE: tpumpimd.c *<br />
* *<br />
* Copyright 1997-2009 <strong>Teradata</strong> Corporation. *<br />
* ALL RIGHTS RESERVED. *<br />
* <strong>Teradata</strong> Corporation CONFIDENTIAL AND TRADE SECRET *<br />
* *<br />
* This copyrighted material is the Confidential, Unpublished *<br />
* Property of the <strong>Teradata</strong> Corporation. This copyright notice and *<br />
* any other copyright notices included in machine readable *<br />
* copies must be reproduced on all authorized copies. *<br />
* *<br />
*************************************************************************<br />
Notes:<br />
This program is for INMOD testing using C user exit routine.<br />
When this routine is activated it looks at the content of the<br />
function code passed (a->code) and depending on its value, it<br />
0) initializes, i.e., opens a file, etc...<br />
1) reads a record<br />
5) acknowledges "close inmod" request. The user exit routine<br />
must return "return code"(a->code) and "length" (a->len). You<br />
should send return code = zero when no errors occur and non-zero for<br />
an error. LOAD expects length = zero at the end of file. Then<br />
it sends "CLOSE INMOD" request. THE USER EXIT routine must<br />
explicitly return "return code" = ZERO to terminate the<br />
conversation.<br />
The following TPUMP control statements will work with this inmod:<br />
.LOGTABLE ;<br />
.LOGON ;<br />
DROP TABLE TABLE200;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 247
Appendix C: INMOD and Notify Exit Routine Examples<br />
C INMOD - UNIX<br />
DROP TABLE ET_TABLE200;<br />
CREATE TABLE TABLE200 (<br />
X1 integer,<br />
x2 char(76)<br />
);<br />
.BEGIN LOAD SESSIONS 4<br />
ERRORTABLE ET_TABLE200;<br />
.LAYOUT TABLE200;<br />
.FIELD x1 1 integer nullif x1 = 5;<br />
.FIELD x2 * char(6) nullif x1 = 4;<br />
.FIELD x3 * char(10) nullif x1 = 4;<br />
.FIELD x4 * char(10) nullif x1 = 4;<br />
.FIELD x5 * char(10) nullif x1 = 4;<br />
.FIELD x6 * char(10) nullif x1 = 4;<br />
.FIELD x7 * char(10) nullif x1 = 4;<br />
.FIELD x8 * char(10) nullif x1 = 4;<br />
.FIELD x9 * char(5) nullif x1 = 4;<br />
.FIELD x10 * char(5) nullif x1 = 4;<br />
.DML LABEL A;<br />
INSERT INTO TABLE200 VALUES<br />
(<br />
:x1<br />
,:x2<br />
);<br />
.IMPORT INMOD <br />
LAYOUT TABLE200<br />
APPLY A FROM 1 THRU 100;<br />
.END LOAD ;<br />
.LOGOFF;<br />
************************************************************************/<br />
#include <br />
#include <br />
#include <br />
typedef unsigned short Int16;<br />
typedef unsigned char Int8;<br />
typedef unsigned long int Int32;<br />
/* PASSING parameter structures<br />
*/<br />
typedef struct {<br />
Int32 code;<br />
Int32 len;<br />
struct {<br />
int seqno;<br />
Int8 body[80];<br />
} buf;<br />
} inmodbuf;<br />
typedef struct {<br />
Int32 seq;<br />
248 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Appendix C: INMOD and Notify Exit Routine Examples<br />
C INMOD - UNIX<br />
Int16 len;<br />
char param[80];<br />
} inmodpty;<br />
static int count=0;<br />
char *memcpy();<br />
static int readrecord(inmodbuf *);<br />
#ifdef<br />
WIN32<br />
__declspec(dllexport) void _dynamn<br />
(a,b)<br />
inmodbuf *a;<br />
inmodpty *b;<br />
#else<br />
void _dynamn(a,b)<br />
inmodbuf *a;<br />
inmodpty *b;<br />
#endif<br />
{int code=0;<br />
/*printf("BEGIN--> %d %d %s\n",a->code,a->len,tempbuf); */<br />
/*printf(" +++ %d %d %s\n",b->seq ,b->len,b->param); */<br />
code= (int) a->code;<br />
switch (code) {<br />
case 0:<br />
/* Here you open the file and read the first record */<br />
/* printf("## CODE=0, openinig...\n"); */<br />
count = 0;<br />
if (! readrecord(a))<br />
printf("Messed up in open.\n");<br />
break;<br />
case 1:<br />
/* Utility requested next record, read it */<br />
/* printf("## CODE=1, reading...\n"); */<br />
if (! readrecord(a))<br />
printf("Messed up in read.\n");<br />
break;<br />
case 5:<br />
/* Utility is closing INMOD routine */<br />
a->code=0;<br />
a->len=0;<br />
/* printf("## CODE=5, terminating...\n"); */<br />
break;<br />
default:<br />
a->code=12; /* any number not = to zero */<br />
a->len=0;<br />
printf("##### UNKNOWN code ######\n");a->code=0;a->len=0;<br />
};<br />
/*printf("END --> %d %d %s\n",a->code,a->len,tempbuf); */<br />
/*printf(" +++ %d %d %s\n",b->seq ,b->len,b->param);*/<br />
}<br />
static int readrecord(a)<br />
inmodbuf *a;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 249
Appendix C: INMOD and Notify Exit Routine Examples<br />
Sample Notify Exit Routine<br />
{<br />
int rtn=0;<br />
int i=0;<br />
if (count < 50000)<br />
{<br />
a->buf.seqno = count;<br />
count++;<br />
for (i=0; ibuf.body[i] = 'X';<br />
a->buf.body[75] = '\0';<br />
}<br />
a->len=80;<br />
a->code=0;<br />
rtn=1;<br />
}<br />
else<br />
{<br />
printf("=== EOF ===\n");<br />
a->code=99;<br />
a->len=0;<br />
};<br />
return(rtn);<br />
Sample Notify Exit Routine<br />
The following is the listing of tldnfyxt.c, the sample notify exit routine that is provided with<br />
<strong>Teradata</strong> T<strong>Pump</strong> software.<br />
/*********************************************************************<br />
* *<br />
* tldnfyxt.c - Sample Notify Exit for Tpump. *<br />
* *<br />
* Copyright 1997-2009 <strong>Teradata</strong> Corporation. *<br />
* ALL RIGHTS RESERVED. *<br />
* <strong>Teradata</strong> Corporation CONFIDENTIAL AND TRADE SECRET *<br />
* *<br />
* This copyrighted material is the Confidential, Unpublished *<br />
* Property of the <strong>Teradata</strong> Corporation. This copyright notice and *<br />
* any other copyright notices included in machine readable *<br />
* copies must be reproduced on all authorized copies. *<br />
* *<br />
* *<br />
* Purpose - This is a sample notify exit for Tpump . *<br />
* *<br />
* Execute - Build Notify on a Unix system *<br />
* compile and link into shared object *<br />
* cc -G tldnfyxt.c - o libtldnfyxt.so *<br />
* - Build Notify on a Win32 system *<br />
* compile and link into dynamic link library *<br />
* cl /DWIN32 /LD tldnfyxt.c *<br />
* - Build Notify on AIX system *<br />
* cc -c -brtl -qalign=packed tldnfyxt.c *<br />
* ld -G -e_dynamn -bE:export_dynamn.txt tldnfyxt.o *<br />
* -o libtldnfyxt.so -lm -lc *<br />
* where export_dynamn.txt conaints the symbol "_dynamn"*<br />
* - Build Notify on Linux system *<br />
250 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Appendix C: INMOD and Notify Exit Routine Examples<br />
Sample Notify Exit Routine<br />
* gcc -shared -fPIC tldnfyxt.c -o libtldnfyxt.so *<br />
* *<br />
**********************************************************************/<br />
#ifdef __MVS__<br />
#pragma pack(1)<br />
#endif<br />
#include <br />
typedef unsigned int UInt32;<br />
typedef int Int32;<br />
#define NOTIFYID_FASTLOAD 1<br />
#define NOTIFYID_MULTILOAD 2<br />
#define NOTIFYID_FASTEXPORT 3<br />
#define NOTIFYID_BTEQ 4<br />
#define NOTIFYID_TPUMP 5<br />
#define MAXVERSIONIDLEN 32<br />
#define MAXUTILITYNAMELEN 36<br />
#define MAXUSERNAMELEN 64<br />
#define MAXUSERSTRLEN 80<br />
#define MAXTABLENAMELEN 128<br />
#define MAXFILENAMELEN 256<br />
typedef enum {<br />
NMEventInitialize = 0,<br />
NMEventFileInmodOpen = 1,<br />
NMEventCkptBeg = 2,<br />
NMEventImportBegin = 3,<br />
NMEventImportEnd = 4,<br />
NMEventErrorTable = 5,<br />
NMEventDBSRestart = 6,<br />
NMEventCLIError = 7,<br />
NMEventDBSError = 8,<br />
NMEventExit = 9,<br />
NMEventTableStats = 10,<br />
NMEventCkptEnd = 11,<br />
NMEventRunStats = 12,<br />
NMEventDMLError = 13<br />
} NfyTLDEvent;<br />
#define TIDUPROW 2816<br />
typedef enum {<br />
DEFeedbackDefault = 0,<br />
DEFeedbackNoLogging = 1<br />
} DMLErrorFeedbackType;<br />
typedef struct _TLNotifyExitParm {<br />
UInt32 Event; /* should be NfyFLDEvent values */<br />
union {<br />
struct {<br />
int VersionLen;<br />
char VersionId[MAXVERSIONIDLEN];<br />
int UtilityId;<br />
int UtilityNameLen;<br />
char UtilityName[MAXUTILITYNAMELEN];<br />
int UserNameLen;<br />
char UserName[MAXUSERNAMELEN];<br />
int UserStringLen;<br />
char UserString[MAXUSERSTRLEN];<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 251
Appendix C: INMOD and Notify Exit Routine Examples<br />
Sample Notify Exit Routine<br />
} Initialize;<br />
struct {<br />
int nImport;<br />
} ImpStart;<br />
struct {<br />
UInt32 FileNameLen; /* for file open event */<br />
char FileOrInmodName[MAXFILENAMELEN];<br />
UInt32 nImport;<br />
} FileOpen ;<br />
struct {<br />
UInt32 Records;<br />
} CheckPt;<br />
struct {<br />
char *TableName;<br />
UInt32 Rows;<br />
} ETDrop ;<br />
struct {<br />
Int32 ReturnCode;<br />
} Exit;<br />
struct {<br />
int nImport;<br />
UInt32 RecsIn;<br />
UInt32 RecsSkipped;<br />
UInt32 RecsRejd;<br />
UInt32 RecsOut;<br />
UInt32 RecsError;<br />
} Complete;<br />
struct {<br />
char type;<br />
char *dbasename;<br />
char *szName;<br />
UInt32 Activity;<br />
} TableStats;<br />
struct {<br />
UInt32 ErrorCode;<br />
} DBSError;<br />
struct {<br />
UInt32 ErrorCode;<br />
} CLIError;<br />
struct {<br />
int nImport;<br />
UInt32 nSQLstmt;<br />
UInt32 nReqSent;<br />
UInt32 RecsIn;<br />
UInt32 RecsSkipped;<br />
UInt32 RecsRejd;<br />
UInt32 RecsOut;<br />
UInt32 RecsError;<br />
} Stats;<br />
struct {<br />
UInt32 nImport;<br />
UInt32 ErrorCode;<br />
char *ErrorMsg;<br />
UInt32 nRecord;<br />
unsigned char nApplySeq;<br />
unsigned char nDMLSeq;<br />
unsigned char nSMTSeq;<br />
char *Error<strong>Data</strong>;<br />
UInt32 Error<strong>Data</strong>Len;<br />
252 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Appendix C: INMOD and Notify Exit Routine Examples<br />
Sample Notify Exit Routine<br />
UInt32 *feedback;<br />
} DMLError;<br />
} Vals;<br />
} TLNotifyExitParm;<br />
#ifdef I370<br />
#define TLNfyExit MLNfEx<br />
#endif<br />
extern Int32 TLNfyExit(<br />
#ifdef __STDC__<br />
TLNotifyExitParm *Parms<br />
#endif<br />
);<br />
#ifdef WIN32<br />
__declspec(dllexport) long _dynamn(TLNotifyExitParm *P)<br />
#else<br />
Int32 _dynamn(P)<br />
TLNotifyExitParm *P;<br />
#endif<br />
{<br />
FILE *fp;<br />
int i;<br />
if (!(fp = fopen("NFYEXIT.OUT", "a")))<br />
return(1);<br />
switch(P->Event) {<br />
case NMEventInitialize : /* Nothing */<br />
fprintf(fp, "exit called @ Tpump init.\n");<br />
fprintf(fp, "Version: %s\n", P->Vals.Initialize.VersionId);<br />
#ifdef __MVS__<br />
P->Vals.Initialize.UtilityName[MAXUTILITYNAMELEN-1] = '\0';<br />
#else<br />
P->Vals.Initialize.UtilityName[MAXUTILITYNAMELEN] = '\0';<br />
#endif<br />
fprintf(fp, "Utility: %s\n", P->Vals.Initialize.UtilityName);<br />
fprintf(fp, "User: %s\n", P->Vals.Initialize.UserName);<br />
if (P->Vals.Initialize.UserStringLen)<br />
fprintf(fp, "UserString: %s\n", P->Vals.Initialize.UserString);<br />
break;<br />
case NMEventFileInmodOpen :<br />
fprintf(fp, "Exit called @ File/Inmod Open\n\<br />
File/Inmod Name : %s Import : %d\n",<br />
P->Vals.FileOpen.FileOrInmodName,P->Vals.FileOpen.nImport);<br />
break;<br />
case NMEventCkptBeg :<br />
fprintf(fp,"exit called @ checkpoint begin : %u Records .\n",<br />
P->Vals.CheckPt.Records);<br />
break;<br />
case NMEventCkptEnd :<br />
fprintf(fp,"exit called @ checkpoint End : %u Records Sent.\n",<br />
P->Vals.CheckPt.Records);<br />
break;<br />
case NMEventCLIError :<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 253
Appendix C: INMOD and Notify Exit Routine Examples<br />
Sample Notify Exit Routine<br />
fprintf(fp, "exit called @ CLI error %d\n",<br />
P->Vals.CLIError.ErrorCode);<br />
break;<br />
case NMEventErrorTable :<br />
fprintf(fp,"exit called @ ErrTable Drop : "<br />
"%u logable records.\n",<br />
P->Vals.ETDrop.Rows);<br />
break;<br />
case NMEventDBSError :<br />
fprintf(fp, "exit called @ DBS error %d\n",<br />
P->Vals.DBSError.ErrorCode);<br />
break;<br />
case NMEventImportBegin:<br />
fprintf(fp, "exit called @ import %d starting. \n",<br />
P->Vals.ImpStart.nImport);<br />
break;<br />
case NMEventImportEnd :<br />
fprintf(fp, "exit called @ import %d ending \n",<br />
P->Vals.Complete.nImport);<br />
fprintf(fp,<br />
"Total Records Read: %u \nRecords Skipped "<br />
"%u \nUnreadable Records:%u \nRecords Sent:<br />
"%u \n<strong>Data</strong> Errors :<br />
P->Vals.Complete.RecsIn,<br />
P->Vals.Complete.RecsSkipped,<br />
P->Vals.Complete.RecsRejd,<br />
P->Vals.Complete.RecsOut,<br />
P->Vals.Complete.RecsError);<br />
%u \n",<br />
break;<br />
case NMEventDBSRestart :<br />
fprintf(fp, "exit called @ RDBMS restarted\n");<br />
break;<br />
case NMEventExit :<br />
fprintf(fp, "exit called @ tpump notify out of scope:"<br />
" return code %d.\n",<br />
P->Vals.Exit.ReturnCode);<br />
break;<br />
case NMEventTableStats:<br />
fprintf(fp,"exit called @ Table Stats: \n");<br />
if(P->Vals.TableStats.type == 'I')<br />
fprintf(fp,"Rows Inserted : "<br />
"%u \nTable/Macro Name : %s \n<strong>Data</strong>base Name"<br />
" : %s \n",<br />
P->Vals.TableStats.Activity,<br />
P->Vals.TableStats.szName,<br />
P->Vals.TableStats.dbasename);<br />
if(P->Vals.TableStats.type == 'U')<br />
fprintf(fp,"Rows Updated : "<br />
"%u \nTable/Macro Name : %s \n<strong>Data</strong>base Name"<br />
" : %s \n",<br />
P->Vals.TableStats.Activity,<br />
254 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Appendix C: INMOD and Notify Exit Routine Examples<br />
Sample Notify Exit Routine<br />
P->Vals.TableStats.szName,<br />
P->Vals.TableStats.dbasename);<br />
if(P->Vals.TableStats.type == 'D')<br />
fprintf(fp,"Rows Deleted : "<br />
"%u \nTable/Macro Name :<br />
" : %s \n",<br />
P->Vals.TableStats.Activity,<br />
P->Vals.TableStats.szName,<br />
P->Vals.TableStats.dbasename);<br />
%s \n<strong>Data</strong>base Name"<br />
break;<br />
case NMEventRunStats :<br />
fprintf(fp, "exit called @ states\n");<br />
fprintf(fp, "import %d \n",<br />
P->Vals.Stats.nImport);<br />
fprintf(fp,<br />
"Total SQL Statements: %u \nRequest Sent: %u \n"<br />
"Records Read: %u \nRecords Skipped: %u \n"<br />
"nUnreadable Records: %u \nRecords Sent: %u \n"<br />
"<strong>Data</strong> Errors : %u \n",<br />
P->Vals.Stats.nSQLstmt,<br />
P->Vals.Stats.nReqSent,<br />
P->Vals.Stats.RecsIn,<br />
P->Vals.Stats.RecsSkipped,<br />
P->Vals.Stats.RecsRejd,<br />
P->Vals.Stats.RecsOut,<br />
P->Vals.Stats.RecsError);<br />
break;<br />
case NMEventDMLError :<br />
fprintf(fp, "exit called @ DML error \n");<br />
fprintf(fp, "import %d \n",<br />
P->Vals.DMLError.nImport);<br />
fprintf(fp,<br />
"Error code: %u \nError text: %s \n"<br />
"Record number: %u \nApply number: %d \n"<br />
"DML number: %d \nStatement number: %d \n"<br />
"Error data length : %u \n"<br />
"feedback : %u \n",<br />
P->Vals.DMLError.ErrorCode,<br />
P->Vals.DMLError.ErrorMsg,<br />
P->Vals.DMLError.nRecord,<br />
P->Vals.DMLError.nApplySeq,<br />
P->Vals.DMLError.nDMLSeq,<br />
P->Vals.DMLError.nSMTSeq,<br />
P->Vals.DMLError.Error<strong>Data</strong>Len,<br />
*(P->Vals.DMLError.feedback));<br />
fprintf(fp, "Error data: ");<br />
for (i=0 ;iVals.DMLError.Error<strong>Data</strong>Len; i++) {<br />
fprintf(fp, "%c", P->Vals.DMLError.Error<strong>Data</strong>[i]);<br />
}<br />
fprintf(fp, "\n");<br />
if (P->Vals.DMLError.ErrorCode == TIDUPROW) {<br />
*(P->Vals.DMLError.feedback) = DEFeedbackNoLogging;<br />
fprintf(fp, "Returning feedback = %u \n",<br />
DEFeedbackNoLogging);<br />
}<br />
break;<br />
default :<br />
fprintf(fp,"\nAn Invalid Event Passed to the Exit Routine\n");<br />
break;<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 255
Appendix C: INMOD and Notify Exit Routine Examples<br />
Sample Notify Exit Routine<br />
}<br />
}<br />
fclose(fp);<br />
return(0);<br />
256 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
APPENDIX D<br />
User-Defined-Types<br />
and User-Defined-Methods<br />
This appendix provides information on User-Defined-Types (UDTs) and<br />
User-Defined-Methods (UDMs):<br />
• User-Defined-Types and User-Defined-Methods<br />
• User-Defined-Methods (UDMs)<br />
• Creating UDTs with <strong>Teradata</strong> T<strong>Pump</strong><br />
• Inserting and Retrieving UDTs with Client Products<br />
• External Types<br />
• Inserting UDTs with <strong>Teradata</strong> T<strong>Pump</strong><br />
• Retrieving UDTs with <strong>Teradata</strong> T<strong>Pump</strong><br />
• Retrieving UDT Metadata with <strong>Teradata</strong> T<strong>Pump</strong><br />
User-Defined-Types and User-Defined-Methods<br />
This section provides a brief overview of how <strong>Teradata</strong> client products support user-defined<br />
custom data types known as User-Defined Types (UDTs), and user-defined custom functions<br />
known as User-Defined Methods (UDMs).<br />
• User-Defined Types (UDTs)<br />
• User-Defined Methods (UDMs)<br />
For more in depth information on using UDTs and UDMs see Introduction to <strong>Teradata</strong>, B035-<br />
1091, SQL External Routine Programming, B035-1147 and SQL Fundamentals, B035-1141.<br />
User-Defined Types (UDTs)<br />
UDTs can be created to provide representations of real world entities within <strong>Teradata</strong><br />
<strong>Data</strong>base. Choosing a set of UDTs which closely matches the entities encountered in a given<br />
business can yield a system which is easier to understand and hence easier to maintain.<br />
Support for UDTs and UDMs integrates the power of object-oriented technology directly into<br />
<strong>Teradata</strong> <strong>Data</strong>base.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 257
Appendix D: User-Defined-Types and User-Defined-Methods<br />
User-Defined-Types and User-Defined-Methods<br />
User-Defined-Methods (UDMs)<br />
<strong>Teradata</strong> <strong>Data</strong>base developer-created custom functions, which are explicitly connected to<br />
UDTs are known as User-Defined-Methods (UDMs). All UDMs must reside on server.<br />
UDMs can be used to create an interface to the UDT that is independent of the UDT's internal<br />
representation. This makes it possible to later enhance a given UDT even in cases where the<br />
internal representation of the UDT must be changed to support the enhancement, without<br />
changing all of the database applications which use the UDT.<br />
Creating UDTs with <strong>Teradata</strong> T<strong>Pump</strong><br />
<strong>Teradata</strong> T<strong>Pump</strong> cannot create a custom UDT.<br />
Inserting and Retrieving UDTs with Client Products<br />
External Types<br />
A UDT can only exist on the <strong>Teradata</strong> <strong>Data</strong>base server. Each UDT has an associated “from-sql<br />
routine” and “to-sql routine”.<br />
• Insert - The “to-sql routine” constructs a UDT value from a pre-defined type value. The<br />
“to-sql routine” is automatically invoked when inserting values from a client system into a<br />
UDT on the <strong>Teradata</strong> <strong>Data</strong>base server.<br />
• Retrieve - The “from-sql routine” generates a pre-defined type value from a UDT. The<br />
“from-sql routine” is automatically invoked when a UDT is retrieved from the <strong>Teradata</strong><br />
<strong>Data</strong>base server to a client system.<br />
The “from-sql routine” and the “to-sql routine” create a mapping between a UDT and a predefined<br />
type. This pre-defined type is called the external type of a UDT. A client application<br />
only deals with the external type; it does not deal with UDT value directly.<br />
External Type Example<br />
For example, if the following conditions exist:<br />
• UDT named FULLNAME exists<br />
• The external type associated with FULLNAME is VARCHAR(46)<br />
Then, during an retrieve of FULLNAME values, the <strong>Teradata</strong> <strong>Data</strong>base server converts the<br />
values from FULLNAME values to VARCHAR(46) values by invoking the “from-sql routine”<br />
associated with the FULLNAME UDT.<br />
Note: The client must expect to receive the data in the same format as it receives<br />
VARCHAR(46) values.<br />
Similarly, when values are provided by the client for insert into a FULLNAME UDT, the client<br />
must provide values in the same way it would provide values for a VARCHAR(46) field. The<br />
<strong>Teradata</strong> <strong>Data</strong>base server will convert the values from VARCHAR(46) to FULLNAME values<br />
using the “to-sql routine” associated with the FULLNAME UDT.<br />
258 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Appendix D: User-Defined-Types and User-Defined-Methods<br />
User-Defined-Types and User-Defined-Methods<br />
Inserting UDTs with <strong>Teradata</strong> T<strong>Pump</strong><br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> program can insert values into tables containing UDT columns<br />
in the same manner as is done for other tables.<br />
• Input Records - The input records to <strong>Teradata</strong> T<strong>Pump</strong> must have the column data for<br />
UDT columns in its external type format. When the input record format is defined, the<br />
external type must be used for the UDT columns. Also, if the “TABLE” command is used<br />
to define the input record format and columns in the referenced tables contain UDTs, then<br />
the external types corresponding to the UDTs will be used in the input record format for<br />
those columns<br />
• Table Command - If the “TABLE” command is used to define the input record format, and<br />
columns in the referenced TABLEs contain UDTs, then the external types corresponding<br />
to the UDTs will be used in the input record format for those columns.<br />
Retrieving UDTs with <strong>Teradata</strong> T<strong>Pump</strong><br />
UDTs cannot be retrieved with <strong>Teradata</strong> T<strong>Pump</strong>.<br />
Retrieving UDT Metadata with <strong>Teradata</strong> T<strong>Pump</strong><br />
UDT metadata cannot be retrieved with <strong>Teradata</strong> T<strong>Pump</strong>.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 259
Appendix D: User-Defined-Types and User-Defined-Methods<br />
User-Defined-Types and User-Defined-Methods<br />
260 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Glossary<br />
A<br />
abend: Abnormal END of a task. Termination of a task prior to its completion because of an<br />
error condition that cannot be resolved by the recovery facilities that operate during<br />
execution.<br />
abort: In <strong>Teradata</strong> SQL, a statement that stops a transaction in progress and backs out<br />
changes to the database only if the conditional expression associated with the abort statement<br />
is true.<br />
account The distinct account name portion of the system account strings, excluding the<br />
performance group designation. Accounts can be employed wherever a user object can be<br />
specified.<br />
access module: A software component that provides a standard set of I/O functions to<br />
access data on a specific device.<br />
Acquisition Phase: Responsible for populating the primary data subtables of the work<br />
tables. <strong>Data</strong> is received from the host, converted into internal format, and inserted into the<br />
work tables. The work tables are sorted at the end of the acquisition phase and prior to the<br />
application phase.<br />
administrator:<br />
A special user responsible for allocating resources to a community of users.<br />
AMP: Access Module Processor. A vproc that receives steps from a PE and performs<br />
database functions to retrieve or update data. Each AMP is associated with one vdisk, where<br />
the data is stored. An AMP manages only its own vdisk and not the vdisk of any other AMP.<br />
ANSI: American National Standards Institute. ANSI maintains a standard for SQL. For<br />
information about <strong>Teradata</strong> compliance with ANSI SQL, see SQL Fundamentals.<br />
Application Phase: Responsible for turning rows from a work table into updates, deletes,<br />
and inserts and applying them to a single target table.<br />
architecture: A definition and preliminary design which describes the components of a<br />
solution and their interactions. Architecture is the blueprint by which implementers construct<br />
a solution that meets the defined needs.<br />
ASCII: American Standard Code for Information Interchange. Pronounced as-key. A<br />
character set used primarily on personal computers.<br />
B<br />
BTEQ: Basic <strong>Teradata</strong> Query. A utility that allows users on a workstation to access data on<br />
<strong>Teradata</strong> <strong>Data</strong>base, and format reports for both print and screen output. A CLI program used<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 261
Glossary<br />
to interact with <strong>Teradata</strong> <strong>Data</strong>base. BTEQ commands control sessions, submit <strong>Teradata</strong> SQL<br />
requests, format results, and handle output data. BTEQ can also be used to verify the<br />
installation of <strong>Teradata</strong> client utilities.<br />
C<br />
CLIv2: Call-Level Interface Version 2. A collection of callable service routines that provide<br />
an interface to <strong>Teradata</strong> <strong>Data</strong>base. Specifically, CLI is the interface between the application<br />
program and the Micro <strong>Teradata</strong> Directory Program (for network-attached clients) or the<br />
Micro Operating System Interface (for network-attached clients). CLIv2 provides the<br />
application with a pointer to each of the parcels returned from <strong>Teradata</strong> <strong>Data</strong>base.<br />
channel-attached: Peripheral devices directly attached to a computer via a channel or bus.<br />
The term is used in contrast with devices that are reached remotely over a network<br />
character set: A grouping of alphanumeric and special characters used by computer systems<br />
to support different user languages and applications. Various character sets have been codified<br />
by the American National Standards Institute (ANSI).<br />
checkpoint rate: The interval between checkpoint operations during the acquisition phase<br />
of an import task, expressed as either the number of rows read from the client system or sent<br />
to <strong>Teradata</strong> <strong>Data</strong>base, or as an amount of time, in minutes.<br />
client:<br />
A computer that can access <strong>Teradata</strong> <strong>Data</strong>base.<br />
cluster: Logical, table-level archive whereby only those rows residing on specific AMPs, and<br />
which are members of the specified cluster, are archived onto a single tape data set. This allows<br />
multiple jobs to be applied for backup of large tables, to reduce the backup window. This<br />
method is used to affect a parallel archive/restore operation via a “divide and conquer” backup<br />
strategy.<br />
column: In the relational model of <strong>Teradata</strong> SQL, databases consist of one or more tables. In<br />
turn, each table consists of fields, organized into one or more columns by zero or more rows.<br />
All of the fields of a given column share the same attributes.<br />
D<br />
DDL: <strong>Data</strong> Definition Language. In <strong>Teradata</strong> SQL, the statements and facilities that<br />
manipulate database structures (such as CREATE, MODIFY, DROP, GRANT, REVOKE, and<br />
GIVE) and the <strong>Data</strong> Dictionary information kept about those structures.<br />
<strong>Data</strong> Dictionary: In <strong>Teradata</strong> <strong>Data</strong>base, the information automatically maintained about all<br />
tables, views, macros, databases, and users known to <strong>Teradata</strong> <strong>Data</strong>base, including<br />
information about ownership, space allocation, accounting, and privilege relationships<br />
between those objects. <strong>Data</strong> Dictionary information is updated automatically during the<br />
processing of data definition statements, and is used by the parser to obtain information<br />
needed to process all <strong>Teradata</strong> SQL statements.<br />
262 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Glossary<br />
data loading: The process of loading data from a client platform to a <strong>Teradata</strong> <strong>Data</strong>base<br />
server. For <strong>Teradata</strong> T<strong>Pump</strong>, data loading includes any combination of INSERT, UPDATE,<br />
DELETE, and UPSERT operations.<br />
data manipulation: In <strong>Teradata</strong> SQL, the statements and facilities that change the<br />
information content of the database. These statements include INSERT, UPDATE, and<br />
DELETE.<br />
data warehouse: A subject oriented, integrated, time-variant, non-volatile collection of data<br />
in support of management’s decision making process. A repository of consistent historical<br />
data that can be easily accessed and manipulated for decision support.<br />
DBA: <strong>Data</strong>base administrator. Generally, a person responsible for the design and<br />
management of one or more databases and for the evaluation, selection, and implementation<br />
of database management systems.<br />
DD:<br />
<strong>Data</strong> dictionary or data definition. See also <strong>Data</strong> Dictionary.<br />
DEFINE statement: A statement preceding the INSERT statement that describes the fields<br />
in a record before the record is inserted in the table. This statement is similar to the SQL<br />
USING clause.<br />
DELETE statement: A task that uses a full file scan to remove a large number of rows from a<br />
single <strong>Teradata</strong> <strong>Data</strong>base table. A delete task is composed of three major phases: preliminary,<br />
application, and end. The phases are a collection of one or more transactions that are<br />
processed in a predefined order according to utility protocol.<br />
delimiter: In <strong>Teradata</strong> SQL, a punctuation mark or other special symbol that separates one<br />
clause in a <strong>Teradata</strong> SQL statement from another, or that separates one <strong>Teradata</strong> SQL<br />
statement from another.<br />
DLL: Dynamic link library. A feature of the Windows family of operating systems that<br />
allows executable routines to be stored separately as files with .dll extensions and to be loaded<br />
only when needed by a program.<br />
DML: <strong>Data</strong> manipulation language. In <strong>Teradata</strong> SQL, the statements and facilities that<br />
manipulate or change the information content of the database. These statements include<br />
SELECT, INSERT, UPDATE, and DELETE.<br />
E<br />
EBCDIC: Extended binary coded decimal interchange code. An IBM code that uses 8 bits to<br />
represent 256 possible characters. It is used primarily in IBM mainframes, whereas personal<br />
computers use ASCII.<br />
error tables: Tables created during processing that capture any errors that occurred. The<br />
<strong>Teradata</strong> convention is to name the tables ET and UV. An ET table contains errors that occur<br />
during the Acquisition Phase related to data and the data environment (such as constraint<br />
violations and unavailable AMPs). A UV table contains errors that occur during the<br />
Application Phase related to violations of unique primary indexes.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 263
Glossary<br />
extract:<br />
The process of copying a subset of data from a source to a target environment.<br />
exit routines: Specifies a predefined action to be performed whenever certain significant<br />
events occur during a utility job.<br />
F<br />
failure: Any condition that precludes complete processing of a <strong>Teradata</strong> SQL statement. Any<br />
failure will abort the current transaction.<br />
FastExport: <strong>Teradata</strong> FastExport utility. A program that quickly transfers large amounts of<br />
data from tables and views of <strong>Teradata</strong> <strong>Data</strong>base to a client application.<br />
FastLoad: <strong>Teradata</strong> FastLoad utility. A program that loads empty tables on <strong>Teradata</strong><br />
<strong>Data</strong>base with data from a network-attached or channel-attached client.<br />
field: The basic unit of information stored in <strong>Teradata</strong> <strong>Data</strong>base. A field is either null, or has<br />
a single numeric or string value. See also column, database, row, table.<br />
I<br />
import: The process of pulling system information into a program. To add system<br />
information from an external source to another system. The system receiving the data must<br />
support the internal format or structure of the data.<br />
INMOD Routine: User-written routines that can be used by load/export utilities to<br />
preprocess input records before they are sent to <strong>Teradata</strong> <strong>Data</strong>base. Routines can be written in<br />
C language (for network-attached platforms), orIBM C, (for channel-attached platforms). A<br />
routine can read and preprocess records from a file, generate data records, read data from<br />
other database systems, validate data records, and convert data record fields.<br />
instance: In object-oriented programming, the relationship between an object and its class.<br />
The object is an instance of the class.<br />
I/O:<br />
Input/output<br />
J<br />
JCL: Job Control Language. A language for describing jobs (units of work) to the OS/390, z/<br />
OS, and VSE operating systems, which run on IBM's OS/390 and z800/900 large server<br />
(mainframe) computers. These operating systems allocate time and space resources among<br />
the total number of active jobs. Jobs in turn break down into job steps, which are the<br />
statements required to run a particular program. Jobs are background (sometimes called<br />
batch) units of work that run without requiring user interaction (for example, print jobs). In<br />
addition, the operating system manages interactive (foreground) user requests that initiate<br />
units of work. In general, foreground work is given priority over background work.<br />
job script: A set of commands and <strong>Teradata</strong> SQL statements that can initiate an operation<br />
that inserts new rows, updates existing rows, and deletes rows in specified target tables and<br />
views in <strong>Teradata</strong> <strong>Data</strong>base.<br />
264 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Glossary<br />
join:<br />
result.<br />
A SELECT operation that combines information from two or more tables to produce a<br />
L<br />
locks: <strong>Teradata</strong> load/unload utilities automatically lock any table being loaded and free a<br />
lock only after an END LOADING statement is entered. Therefore, tables are only available<br />
when the operation is complete.<br />
log: A record of events. A file that records events. Many programs produce log files. Often a<br />
log file is looked at to determine what is happening when problems occur. Log files have the<br />
extension “.log”.<br />
M<br />
macro: A file created and stored on <strong>Teradata</strong> <strong>Data</strong>base and executed in response to a<br />
<strong>Teradata</strong> SQL EXECUTE statement. Each macro execution is implicitly treated as a<br />
transaction.<br />
methods: In object-oriented programming, programming routines by which objects are<br />
manipulated.<br />
MultiLoad: <strong>Teradata</strong> MultiLoad utility. A command-driven utility that performs fast, highvolume<br />
maintenance functions on multiple tables and views of <strong>Teradata</strong> <strong>Data</strong>base.<br />
multiset tables:<br />
Tables that allow duplicate rows.<br />
N<br />
name: A word supplied by the user that refers to an object, such as a column, database,<br />
macro, table, user, or view.<br />
network-attached: A computer that communicates over the LAN with a server (for<br />
example, <strong>Teradata</strong> <strong>Data</strong>base).<br />
notify exit: A user-defined exit routine that specifies a predefined action to be performed<br />
whenever certain significant events occur during a job. For example, by writing an exit in C<br />
(without using CLIv2) and using the NotifyExit attribute, the routine can detect whether a job<br />
succeeds or fails, the number of loaded records, the return code for a failed job, and so on.<br />
null:<br />
The absence of a value for a field.<br />
O<br />
object: In object-oriented programming, a unique instance of a data structure defined<br />
according to the template provided by its class. Each object has its own values for the variables<br />
belonging to its class and can respond to the messages, or methods, defined by its class.<br />
owner: In <strong>Teradata</strong> SQL, the user who has the ability to grant or revoke all privileges on a<br />
database. By default, the creator of the database is the owner, but ownership can be transferred<br />
from one user to another by the GIVE statement.<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 265
Glossary<br />
P<br />
parameter: A variable name in a macro for which an argument value is substituted when<br />
the macro is executed.<br />
parser: A program executing in a PE that translates <strong>Teradata</strong> SQL statements entered by a<br />
user into the steps that accomplish the user’s intensions.<br />
PE: Parsing engine. The vprocs that receive SQL requests from the client and break the<br />
requests into steps. The PE sends the steps to the AMPs and subsequently returns the answer<br />
to the client.<br />
primary key: The field (column) in a database table that is indexed and maintains the main<br />
sequence of the table. For example, account numbers are typically primary keys. A "composite<br />
primary key" is made up of two or more fields (columns) such as region + account number. A<br />
primary key is also known as a unique identifier.<br />
privilege: A user’s right to perform read, write, and execute operations against a table,<br />
database, user, macro, or view.<br />
R<br />
RDBMS (Relational <strong>Data</strong>base Management System): A database management system in<br />
which complex data structures are represented as simple two-dimensional tables consisting of<br />
columns and rows. For <strong>Teradata</strong>, RDBMS is referred to as <strong>Teradata</strong> <strong>Data</strong>base.<br />
records: When using <strong>Teradata</strong> utilities, both formatted and unformatted records are<br />
accepted for loading. A formatted record, in the <strong>Teradata</strong> <strong>Data</strong>base world, consists of a record<br />
created by a <strong>Teradata</strong> utility, such as BTEQ, where the record is packaged with begin- and endrecord<br />
bytes specific to <strong>Teradata</strong> <strong>Data</strong>base. Unformatted records are any data file, such as a text<br />
file, that does not have various properties such as a consistent structure with regard to record<br />
length and order of data elements. These files must be defined before loading onto <strong>Teradata</strong><br />
<strong>Data</strong>base.<br />
request:<br />
<strong>Data</strong>base.<br />
In host software, a message sent from an application program to <strong>Teradata</strong><br />
restart log table:<br />
paused job.<br />
One of four restart tables that the <strong>Teradata</strong> utilities require for restarting a<br />
result:<br />
The information returned to the user to satisfy a request made of <strong>Teradata</strong> <strong>Data</strong>base.<br />
row: The fields that represent one entry under each column in a table. The row is the<br />
smallest unit of information operated on by data manipulation statements.<br />
S<br />
schema: Used for identifying the structure of data. Producers have an output schema to<br />
define what the source data will look like in the data stream. Consumers have an input schema<br />
to define what is read from the data stream. If the input and output schemas are the same, the<br />
schema need only be defined once.<br />
266 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Glossary<br />
script:<br />
or job.<br />
A file that contains a set of commands and SQL statements that initiates an operation<br />
separator: A character or group of characters that separates words and special symbols in<br />
<strong>Teradata</strong> SQL. Blanks and comments are the most common separators.<br />
server: The computer system running <strong>Teradata</strong> <strong>Data</strong>base. Typically, a <strong>Teradata</strong> <strong>Data</strong>base<br />
server has multiple nodes, which may include both TPA and non-TPA nodes. All nodes of the<br />
server are connected via the <strong>Teradata</strong> BYNET or other similar interconnect.<br />
session: A session begins when the user logs on to <strong>Teradata</strong> <strong>Data</strong>base and ends when the<br />
user logs off <strong>Teradata</strong> <strong>Data</strong>base. Also called a <strong>Teradata</strong> <strong>Data</strong>base session. In client software, a<br />
logical connection between an application program on a host and <strong>Teradata</strong> <strong>Data</strong>base that<br />
permits the application program to send one request to and receive one response from<br />
<strong>Teradata</strong> <strong>Data</strong>base at a time.<br />
source: The table designated to receive data that is moved or copied from some other source<br />
file, table, or database.<br />
SQL: Structured Query Language. An industry-standard language for creating, updating<br />
and, querying relational database management systems. SQL was developed by IBM in the<br />
1970s for use in System R. It is the de facto standard as well as being an ISO and ANSI<br />
standard. It is often embedded in general purpose programming languages.<br />
The programming language used to communicate with <strong>Teradata</strong> <strong>Data</strong>base.<br />
SSO: Single Sign On. An authentication option that allows <strong>Teradata</strong> users on Windows<br />
systems to access <strong>Teradata</strong> <strong>Data</strong>base based on authorized network usernames and passwords.<br />
This feature simplifies the procedure requiring users to enter an additional username and<br />
password when logging on to <strong>Teradata</strong> <strong>Data</strong>base using client applications.<br />
statement: A request for processing by <strong>Teradata</strong> <strong>Data</strong>base that consists of a keyword verb,<br />
optional phrases, operands, and is processed as a single entity.<br />
statistics: The details of the processes used to collect, analyze, and transform the database<br />
objects used by a given query.<br />
T<br />
table: A set of one or more columns with zero or more rows that consist of fields of related<br />
information.<br />
target database: The database designated to receive data that is moved or copied from some<br />
other source file, table, or database.<br />
target table: the table designated to receive data that is moved or copied from another table,<br />
source file, or database.<br />
TDPID:<br />
accessed.<br />
<strong>Teradata</strong> Director Program Identifier. The name of the <strong>Teradata</strong> <strong>Data</strong>base being<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 267
Glossary<br />
<strong>Teradata</strong> SQL: <strong>Teradata</strong> <strong>Data</strong>base dialect of the relational language SQL, having data<br />
definition and data manipulation statements. For example, CREATE TABLE is a data<br />
definition statement. A data manipulation statement is a data retrieval statement, such as<br />
SELECT.<br />
transaction: A set of <strong>Teradata</strong> SQL statements executed as a unit. All of the statements must<br />
execute normally or else any changes made during the transaction are backed out and none of<br />
the remaining statements in the transaction are executed. <strong>Teradata</strong> <strong>Data</strong>base supports both<br />
ANSI and <strong>Teradata</strong> transaction semantics.<br />
trigger: One or more <strong>Teradata</strong> SQL statements associated with a table and executed when<br />
specified conditions are met.<br />
type: A column attribute that specifies the representation of data values for fields in that<br />
column. <strong>Teradata</strong> SQL data types include numerics and strings.<br />
U<br />
UDF User-Defined Function. UDFs are extensions to <strong>Teradata</strong> SQL. Users can write UDFs<br />
to analyze and transform data already stored in their data warehouse in ways that are beyond<br />
the functionality of <strong>Teradata</strong>’s native functions.<br />
UDM User-Defined Method. A custom function explicitly connected to a UDT.<br />
Functionality applicable to a UDT can be located in the UDM associated with that UDT<br />
instead of being replicated to all of the applications that use that UDT, simplifies maintenance.<br />
UDT User-Defined Type. A collection of one or more data values organized into a single<br />
customized data type and a set of methods that operates on those values.<br />
user: In <strong>Teradata</strong> SQL, a database associated with a person who uses <strong>Teradata</strong> <strong>Data</strong>base. The<br />
database stores the person’s private information and accesses other <strong>Teradata</strong> <strong>Data</strong>bases.<br />
UPI: Unique primary index; a UPI is required and is typically assigned to major entities in<br />
the database.<br />
user: A person who uses <strong>Teradata</strong> <strong>Data</strong>base. The database stores the person’s private<br />
information and accesses other <strong>Teradata</strong> <strong>Data</strong>bases.<br />
UTF-8: <strong>Teradata</strong>’s 8-bit multi-byte character set used by <strong>Teradata</strong> <strong>Data</strong>base to calculate an<br />
export width based on column character set (Latin, Unicode, KanjiSJIS) and for the session.<br />
For example "Col1 Char(100) Latin Character set" will be exported as 100 bytes for ASCII<br />
session and 300 bytes in UTF8.<br />
UTF-16<br />
<strong>Teradata</strong>’s 16-bit multi-byte character set.<br />
Z<br />
z/Linux Linux operating system (RedHat or SuSE) compiled to run on IBM System z<br />
machines.<br />
268 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Glossary<br />
z/OS (MVS (Multiple Virtual Storage)<br />
computers.<br />
One of the primary operating systems for large IBM<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 269
Glossary<br />
270 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Index<br />
Symbols<br />
- 46<br />
&SYSAPLYCNT system variable 60<br />
&SYSDATE system variable 59<br />
&SYSDATE4 system variable 59<br />
&SYSDAY system variable 59<br />
&SYSDELCNT system variable 59<br />
&SYSETCNT system variable 59<br />
&SYSINSCNT system variable 59<br />
&SYSJOBNAME system variable 59<br />
&SYSNOAPLYCNT system variable 60<br />
&SYSOS system variable 59<br />
&SYSRC system variable 59<br />
&SYSRCDCNT system variable 59<br />
&SYSRJCTCNT system variable 60<br />
&SYSUPDCNT system variable 60<br />
&SYSUSER system variable 60<br />
(serialize_on_field specification<br />
DML command 117<br />
./ prefix<br />
EXIT name specification, BEGIN EXPORT command 149<br />
A<br />
abort termination 52<br />
aborted <strong>Teradata</strong> T<strong>Pump</strong> job<br />
recovery 55<br />
ACCEPT command<br />
definition 90<br />
function 29<br />
syntax 93<br />
acctid specification<br />
LOGON command 168<br />
Acquisition Error Table 200<br />
aggregate operators, programming considerations 67<br />
ALTER TABLE SQL statement 30<br />
alternate error file runtime parameter 48<br />
ANSI/SQL DateTime specifications<br />
programming considerations 62<br />
restrictions 63<br />
ANSIDATE keyword<br />
DATEFORM command 109<br />
APPEND keyword<br />
BEGIN LOAD command 97<br />
application commands<br />
syntax 89<br />
APPLY label specification, IMPORT command 152<br />
ArraySupport keyword<br />
BEGIN LOAD 101, 118<br />
Atomic upsert feature 125<br />
Atomic UPSERT keyword<br />
EXECUTE command 130<br />
AXSMOD keyword<br />
IMPORT command 148<br />
AXSMOD name, IMPORT command 148<br />
B<br />
-b runtime parameter 45<br />
batch mode<br />
syntax for invoking on UNIX 43<br />
syntax for invoking on Windows 43<br />
syntax for invoking on z/OS 44<br />
BEGIN LOAD command<br />
definition 90<br />
function 29<br />
in script 69<br />
syntax 96<br />
BRIEF runtime parameter 45<br />
buffers per session runtime parameter 45<br />
BUFFERS runtime parameter 45<br />
C<br />
-c charactersetname runtime parameter 45<br />
C language INMODs<br />
programming structure 205<br />
C language, comment support 63<br />
-C runtime parameter 47<br />
character sets<br />
Chinese and Korean 24<br />
client system specifications 64<br />
default 64<br />
effects on <strong>Teradata</strong> T<strong>Pump</strong> commands 65<br />
for AXSMOD 64<br />
Japanese 23<br />
runtime parameters 45<br />
site defined 27<br />
<strong>Teradata</strong> <strong>Data</strong>base default 64<br />
Unicode 25<br />
UTF-16 26<br />
UTF-8 26<br />
character-to-date data conversions 25<br />
character-to-numeric<br />
data conversions 25<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 271
Index<br />
charpos1 94<br />
charpos2 94<br />
CHARSET= charactersetname runtime parameter 45<br />
CHECKPOINT keyword<br />
BEGIN LOAD command 99<br />
CHECKPOINT SQL statement 30<br />
checkpoints<br />
description 25<br />
Chinese and Korean character sets 24<br />
cname specification<br />
INSERT command 157<br />
UPDATE statement 188<br />
COLLECT STATISTICS SQL statement 30<br />
command<br />
function 29<br />
in script 70<br />
overview 33<br />
command functions 28<br />
commands<br />
ACCEPT<br />
definition 90<br />
function 29<br />
syntax 93<br />
BEGIN LOAD<br />
definition 90<br />
function 29<br />
syntax 96<br />
DATEFORM<br />
definition 90<br />
function 29<br />
syntax 109<br />
DISPLAY<br />
definition 90<br />
function 29<br />
syntax 113<br />
DML<br />
definition 90<br />
function 29<br />
syntax 115<br />
ELSE<br />
definition 90<br />
function 29<br />
syntax 144<br />
END LOAD<br />
definition 90<br />
function 29<br />
syntax 129<br />
ENDIF<br />
definition 90<br />
function 29<br />
syntax 144<br />
FIELD<br />
definition 90<br />
function 29<br />
syntax 133<br />
FILLER<br />
definition 90<br />
function 30<br />
syntax 142<br />
IF<br />
definition 91<br />
syntax 144<br />
IMPORT<br />
definition 91<br />
function 30<br />
syntax 146<br />
LAYOUT<br />
definition 91<br />
function 30<br />
syntax 160<br />
LOGOFF<br />
definition 91<br />
function 29<br />
syntax 165<br />
LOGON<br />
definition 91<br />
function 29<br />
syntax 167<br />
LOGTABLE<br />
definition 91<br />
function 29<br />
syntax 171<br />
NAME<br />
definition 91<br />
function 29<br />
syntax 173<br />
PARTITION<br />
definition 91<br />
function 30<br />
syntax 175<br />
ROUTE<br />
definition 91<br />
function 29<br />
syntax 179<br />
RUN FILE<br />
definition 91<br />
function 29<br />
syntax 181<br />
SET<br />
definition 91<br />
function 29<br />
syntax 183<br />
SYSTEM<br />
definition 91<br />
function 29<br />
syntax 185<br />
TABLE<br />
definition 91<br />
272 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Index<br />
function 30<br />
syntax 186<br />
usage 57<br />
COMMENT 31<br />
comment support 63<br />
condition specification<br />
LAYOUT command 161<br />
conditional expression specification<br />
IF, ELSE, and ENDI command 144<br />
conditional expressions 57<br />
CONFIG runtime parameter 47<br />
configuration file<br />
optional specification 41<br />
parameters overridden by runtime parameters<br />
BRIEF 45<br />
CHARSET 45<br />
ERRLOG 48<br />
runtime parameter 47<br />
conversions<br />
character-to-numeric 25<br />
integer-to-decimal 25<br />
numeric-to-numeric 25<br />
CREATE DATABASE SQL statement 31<br />
CREATE MACRO SQL statement 31<br />
CREATE TABLE SQL statement 31<br />
CREATE VIEW SQL statement 31<br />
D<br />
-d runtime parameter 48<br />
data<br />
file concatenation, programming considerations 67<br />
data conversions<br />
capabilities 25<br />
character-to-date 25<br />
character-to-numeric 25<br />
date-to-character 25<br />
integer-to-decimal 25<br />
numeric-to-numeric 25<br />
data definition language 17, 37, 108<br />
data dictionary, defined 262<br />
data formats 22<br />
data manipulation language 17, 37, 108<br />
data serialization 18<br />
data types<br />
ANSI/SQL DateTime 62<br />
ANSI/SQL DateTime restrictions 63<br />
database objects<br />
protection and location 53<br />
database specification<br />
DATABASE command 108<br />
EXECUTE command 130<br />
DATABASE SQL statement 31<br />
definition 92<br />
syntax 108<br />
datadesc specification<br />
FIELD command 134<br />
FILLER command 142<br />
DATAENCRYPTION keyword<br />
BEGIN LOAD command 100, 176<br />
DATEFORM command<br />
definition 90<br />
function 29<br />
syntax 109<br />
DateTime data types, specifying 62<br />
date-to-character data conversions 25<br />
dbname specification<br />
BEGIN LOAD command 104<br />
LOGTABLE command 171<br />
dbname. specification<br />
BEGIN LOAD command 98<br />
DDL 17, 37, 108<br />
ddname specification<br />
IMPORT command 147<br />
decimal, zoned 25<br />
DELETE 130<br />
macro 131<br />
DELETE DATABASE SQL statement 31<br />
DELETE DML statement<br />
in script 70, 71<br />
DELETE SQL statement 31, 111<br />
definition 92<br />
syntax 111<br />
DISPLAY command<br />
definition 90<br />
function 29<br />
syntax 113<br />
DISPLAY ERRORS keyword, IMPORT command 152<br />
DML 17, 29, 33, 37, 70, 108<br />
DML command<br />
definition 90<br />
syntax 115<br />
DROP DATABASE SQL statement 31<br />
DROP keyword, FIELD command 135<br />
dynamn entry point<br />
for C INMOD routines 205, 206<br />
for IBM C INMOD routines 205, 206<br />
E<br />
-e filename runtime parameter 48<br />
echo 179<br />
ELSE command<br />
definition 90<br />
function 29<br />
syntax 144<br />
END LOAD command<br />
definition 90<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 273
Index<br />
function 29<br />
in script 71<br />
syntax 129<br />
ENDIF command<br />
definition 90<br />
function 29<br />
syntax 144<br />
env_var 93<br />
errcount specification<br />
BEGIN LOAD command 99<br />
ERRLIMIT keyword<br />
BEGIN LOAD command 99<br />
ERRLOG=filename runtime parameter 48<br />
error detection 195<br />
error tables<br />
acquisition 200<br />
reading 199<br />
troubleshooting 199<br />
errors 195<br />
ERRORTABLE keyword<br />
BEGIN LOAD command 97<br />
EXECUTE SQL statement<br />
definition 92<br />
EXECUTE statement<br />
syntax 130<br />
EXIT keyword<br />
BEGIN LOAD command 105<br />
EXIT name specification, BEGIN LOAD command 105<br />
exit routines, definition 204<br />
expr specification<br />
UPDATE statement 188<br />
expression specification<br />
INSERT command 157<br />
SET command 183<br />
expressions, programming considerations 67<br />
F<br />
-f runtime parameter 45<br />
features, advanced, INMODs 203<br />
FIELD command<br />
definition 90<br />
function 29<br />
in script 70<br />
syntax 133<br />
fieldexpr specification<br />
FIELD command 135<br />
fieldname specification<br />
FIELD command 133<br />
FILLER command 142<br />
INSERT command 157<br />
file requirements<br />
for invoking <strong>Teradata</strong> T<strong>Pump</strong> 41<br />
fileid 94, 113<br />
filename specification<br />
IMPORT command 149<br />
FILLER command<br />
definition 90<br />
function 30<br />
in script 70<br />
syntax 142<br />
FOR n specification, IMPORT command 150<br />
FREE option, IMPORT command 149<br />
frequency specification<br />
BEGIN LOAD command 100<br />
FROM keyword<br />
IMPORT command 150<br />
G<br />
GIVE SQL statement 31<br />
GRANT SQL statement 31<br />
graphic constants<br />
hexadecimal 67<br />
KanjiEBCDIC 67<br />
support for 67<br />
graphic data types<br />
support for 66<br />
H<br />
HOLD option<br />
IMPORT command 149<br />
hours specification<br />
BEGIN LOAD command 101<br />
I<br />
IF command<br />
definition 91<br />
syntax 144<br />
IGNORE keyword<br />
DML command 116<br />
IMPORT command<br />
definition 91<br />
function 30<br />
in script 71<br />
syntax 146<br />
INDICATORS keyword<br />
LAYOUT command 162<br />
INFILE filename specification<br />
IMPORT command 149<br />
INFILE keyword<br />
IMPORT command 147, 149<br />
infilename standard input file specification 50<br />
init-string specification<br />
IMPORT command 148<br />
INMODs 203<br />
compiling and linking 218<br />
274 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Index<br />
FastLoad 215<br />
IBM interface 214<br />
input return code values 216<br />
input values 216, 217<br />
interface 214<br />
major functions 203<br />
output return code values 217<br />
preparing program 216<br />
programming 218<br />
routines<br />
entry points 205<br />
platforms supported 204<br />
programming languages supported 204<br />
programming structure 205<br />
rules and restrictions 211<br />
using 213<br />
<strong>Teradata</strong> T<strong>Pump</strong> interface 214<br />
UNIX interface 214<br />
UNIX programming 218<br />
Windows interface 215<br />
input/output<br />
controlling 38<br />
INSERT DML statement<br />
in script 70<br />
INSERT keyword<br />
DML command 116<br />
EXECUTE command 130<br />
INSERT macro 131<br />
INSERT SQL statement 31<br />
definition 92<br />
syntax 157<br />
INTEGERDATE keyword<br />
DATEFORM command 109<br />
integer-to-decimal<br />
data conversions 25<br />
internationalization 18<br />
invoking<br />
on UNIX platform 42<br />
on Windows platform 42<br />
invoking <strong>Teradata</strong> T<strong>Pump</strong> 41<br />
J<br />
Japanese character sets 23<br />
job<br />
recovery if aborted 55<br />
jobname specification<br />
NAME command 173<br />
K<br />
kanjiEBCDIC<br />
graphic constants 67<br />
KEY keyword, FIELD command 135<br />
keyword<br />
EXECUTE command 130<br />
Korean and Chinese character sets 24<br />
L<br />
LABEL keyword<br />
DML command 115<br />
label specification<br />
DML command 116<br />
IMPORT command 152<br />
LATENCY keyword<br />
BEGIN LOAD command 102<br />
LAYOUT command<br />
definition 91<br />
function 30<br />
in script 70<br />
syntax 160<br />
LAYOUT name specification, IMPORT command 152<br />
layoutname specification<br />
IMPORT command 152<br />
LAYOUT command 160<br />
lock<br />
access 34<br />
acquisition 34<br />
application 34<br />
row hash locking 34<br />
write 34<br />
log table<br />
space requirement calculation example 86<br />
space requirements 85<br />
LOGDATA command<br />
syntax 163<br />
LOGMECH command<br />
syntax 164<br />
LOGOFF command<br />
definition 91<br />
function 29<br />
messages 80<br />
syntax 165<br />
logoff/disconnect message 75<br />
LOGON command<br />
definition 91<br />
function 29<br />
syntax 167<br />
LOGTABLE command<br />
definition 91<br />
function 29<br />
syntax 171<br />
logtables<br />
non-shareability 171<br />
space requirements 172<br />
M<br />
-m runtime parameter 49<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 275
Index<br />
macro runtime parameters 49<br />
MACRODB keyword<br />
BEGIN LOAD command 104<br />
macros 33<br />
predefined 34<br />
<strong>Teradata</strong> T<strong>Pump</strong> usage 18<br />
MACROS runtime parameter 49<br />
MARK keyword<br />
DML command 116<br />
maximum<br />
row size, programming considerations 67<br />
messages 179<br />
minutes specification<br />
BEGIN LOAD command 102<br />
MODIFY DATABASE SQL statement 31<br />
monitor facility 81<br />
MSG string specification, BEGIN LOAD command 105<br />
MultiLoad utility<br />
data conversion capabilities 25<br />
MULTISET table 104<br />
N<br />
name 130<br />
NAME command<br />
definition 91<br />
function 29<br />
syntax 173<br />
name specification<br />
BEGIN LOAD command 105<br />
IMPORT command 148<br />
Named Pipes Access Module 148<br />
No Primary Index tables 19<br />
NOATOMICUPSERT 104<br />
NODROP keyword<br />
BEGIN LOAD command 97<br />
NOMONITOR keyword<br />
BEGIN LOAD command 104<br />
non-shareability<br />
logtables 171<br />
NoPI tables 19<br />
normal termination 51<br />
NOSTOP keyword, IMPORT command 152<br />
NOTIFY option specification, BEGIN LOAD command 105<br />
NOTIMERPROCESS keyword<br />
BEGIN LOAD command 102<br />
nullexpr specification<br />
FIELD command 134<br />
number specification<br />
BEGIN LOAD command 97<br />
PARTITION command 175<br />
numeric-to-numeric<br />
data conversions 25<br />
O<br />
operators<br />
reserved words 56<br />
options messages 75, 79<br />
oscommand string specification<br />
SYSTEM command 185<br />
outfilename standard output file specification 50<br />
P<br />
pack factor 85, 86<br />
PACK keyword<br />
BEGIN LOAD command 103<br />
PARTITION command 176<br />
packing 119, 158<br />
packing factor 85, 103, 104, 177<br />
PACKMAXIMUM keyword<br />
BEGIN LOAD command 102<br />
PARTITION command 176<br />
parms specification<br />
IMPORT command 150<br />
PARTITION command<br />
definition 91<br />
function 30<br />
syntax 175<br />
PARTITION keyword<br />
DML command 117<br />
partition_name specification<br />
DML command 117<br />
PARTITION command 176<br />
password specification<br />
LOGON command 168<br />
performance checklist<br />
troubleshooting<br />
performance checklist 202<br />
periodicity runtime parameter 48<br />
PRDICITY runtime parameter 48<br />
predefined<br />
macros 34<br />
preparing a <strong>Teradata</strong> T<strong>Pump</strong> script 69<br />
privileges 34<br />
product version numbers 3<br />
programming INMODs<br />
for UNIX-based clients 218<br />
UNIX-based clients 218<br />
R<br />
-r tpump command runtime parameter 49<br />
RATE keyword<br />
BEGIN LOAD command 103<br />
recovery<br />
aborted <strong>Teradata</strong> T<strong>Pump</strong> job 55<br />
procedures 52<br />
276 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Index<br />
reduced print output runtime parameter 45<br />
redundant conversions<br />
supported 25<br />
RENAME SQL statement 31<br />
REPLACE MACRO SQL statement 31<br />
REPLACE VIEW SQL statement 31<br />
reporting<br />
options messages 79<br />
statistics 75<br />
restart 76<br />
reserved words<br />
use in <strong>Teradata</strong> T<strong>Pump</strong> 56<br />
restart<br />
statistics 76<br />
restart log table 52, 53<br />
restart procedures 52<br />
restrictions and limitations<br />
programming considerations<br />
aggregate operators 67<br />
data file concatenation 67<br />
expressions 67<br />
maximum row size 67<br />
<strong>Teradata</strong> RDBMS data retrieval 67<br />
retcode specification<br />
LOGOFF command 165<br />
return codes 51<br />
REVOKE SQL statement 31<br />
ROBUST keyword<br />
BEGIN LOAD command 104<br />
ROUTE command<br />
definition 91<br />
function 29<br />
syntax 179<br />
row<br />
size, maximum 67<br />
row count variables 61<br />
row hash locking 34<br />
RUN FILE command<br />
definition 91<br />
function 29<br />
syntax 181<br />
S<br />
script<br />
example 72<br />
preparation 69<br />
writing guidelines 69<br />
writing procedure 71<br />
scriptencoding parameter 46<br />
seconds specification<br />
BEGIN LOAD command 102<br />
SERIALIZE keyword<br />
BEGIN LOAD command 102<br />
SERIALIZEON keyword<br />
DML command 117<br />
sessions 91, 96, 101, 165, 167<br />
SESSIONS keyword<br />
BEGIN LOAD command 97<br />
PARTITION command 176<br />
SET command<br />
definition 91<br />
function 29<br />
syntax 183<br />
SET QUERY_BAND SQL statement 31<br />
SET SESSION COLLATION SQL statement 31<br />
single sign on 167<br />
SLEEP keyword 97, 101, 177<br />
BEGIN LOAD command 104<br />
software releases<br />
supported 3<br />
space requirements<br />
for <strong>Teradata</strong> T<strong>Pump</strong> log tables 85<br />
log table 85<br />
SQL<br />
defined 267<br />
SQL statements<br />
DATABASE<br />
definition 92<br />
syntax 108<br />
DELETE<br />
definition 92<br />
syntax 111<br />
EXECUTE<br />
definition 92<br />
syntax 130<br />
INSERT<br />
definition 92<br />
syntax 157<br />
supported by <strong>Teradata</strong> T<strong>Pump</strong> 30<br />
UPDATE<br />
definition 92<br />
syntax 188<br />
SQL, <strong>Teradata</strong> 37<br />
SSO<br />
LOGON command 167<br />
starting <strong>Teradata</strong> T<strong>Pump</strong><br />
on UNIX platform 42<br />
on Windows platform 42<br />
startpos specification<br />
FIELD command 133<br />
FILLER command 142<br />
statement_rate specification<br />
BEGIN LOAD command 104<br />
statements 33<br />
statements specification<br />
BEGIN LOAD command 103<br />
PARTITION command 177<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 277
Index<br />
statements to execute if FALSE specification<br />
IF, ELSE, and ENDIF command 144<br />
statements to execute if TRUE specification<br />
IF, ELSE, and ENDIF command 144<br />
statements to resume with specification<br />
IF, ELSE, and ENDIF command 144<br />
statistics 75<br />
facility 74<br />
restart 76<br />
string variable<br />
MSG specification, BEGIN LOAD command 105<br />
TEXT specification, BEGIN LOAD command 105<br />
support commands, defined 28<br />
support environment 37<br />
SYSAPLYCNT system variable 60<br />
SYSDATE system variable 59<br />
SYSDATE4 system variable 59<br />
SYSDAY system variable 59<br />
SYSDELCNT system variable 59<br />
SYSETCNT system variable 59<br />
SYSINSCNT system variable 59<br />
SYSJOBNAME 29<br />
SYSJOBNAME system variable 59<br />
SYSNOAPLYCNT system variable 60<br />
SYSOS system variable 59<br />
SYSRC system variable 59<br />
SYSRCDCNT system variable 59<br />
SYSRJCTCNT system variable 60<br />
SYSTEM command<br />
definition 91<br />
function 29<br />
syntax 185<br />
system failure<br />
restart and recovery 52<br />
system variables<br />
&SYSAPLYCNT 60<br />
&SYSDATE 59<br />
&SYSDATE4 59<br />
&SYSDAY 59<br />
&SYSDELCNT 59<br />
&SYSETCNT 59<br />
&SYSINSCNT 59<br />
&SYSJOBNAME 59<br />
&SYSNOAPLYCNT 60<br />
&SYSOS 59<br />
&SYSRC 59<br />
&SYSRCDCNT 59<br />
&SYSRJCTCNT 60<br />
&SYSTIME<br />
&SYSTIME system variable 60<br />
&SYSUPDCNT 60<br />
&SYSUSER 60<br />
SYSTIME system variable 60<br />
SYSUPDCNT system variable 60<br />
SYSUSER system variable 60<br />
T<br />
TABLE command<br />
definition 91<br />
function 30<br />
in script 70<br />
syntax 186<br />
tableref specification<br />
TABLE command 186<br />
tables<br />
fallback 36<br />
nonfallback 36<br />
task<br />
commands 28<br />
task commands 38<br />
syntax and usage 89<br />
usage 57<br />
tdpid specification<br />
LOGON command 167<br />
TENACITY keyword 101<br />
BEGIN LOAD command 101<br />
<strong>Teradata</strong> OLE DB Access Module 148<br />
<strong>Teradata</strong> RDBMS<br />
data retrieval, programming considerations 67<br />
<strong>Teradata</strong> SQL 37<br />
<strong>Teradata</strong> SQL statements<br />
supported by <strong>Teradata</strong> T<strong>Pump</strong> 30<br />
<strong>Teradata</strong> T<strong>Pump</strong><br />
advanced features 203<br />
invoking<br />
batch mode on UNIX 43<br />
batch mode on Windows 43<br />
batch mode on z/OS 44<br />
macros 33<br />
Monitor facility 81<br />
Monitor facility interface 81<br />
script, example of 72<br />
support command, defined 28<br />
support environment 38<br />
using INMOD routines 213<br />
<strong>Teradata</strong> T<strong>Pump</strong> Conditional Expressions 57<br />
<strong>Teradata</strong> T<strong>Pump</strong>/INMOD Routine Interface 206<br />
<strong>Teradata</strong> WebSphere® MQ Access Module 148<br />
<strong>Teradata</strong> WebSphere® MQ Access Module (server version)<br />
148<br />
terminating a <strong>Teradata</strong> T<strong>Pump</strong> job 52<br />
termination<br />
return codes 51<br />
text 113<br />
TEXT string specification, BEGIN LOAD command 105<br />
threshold specification<br />
PARTITION command 177<br />
278 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference
Index<br />
THRU keyword<br />
IMPORT command 150<br />
time and date variables 60<br />
tname specification<br />
BEGIN LOAD command 98<br />
DELETE statement 111<br />
INSERT command 157<br />
LOGTABLE command 171<br />
UPDATE statement 188<br />
tpump command runtime parameter 49<br />
troubleshooting 195<br />
early error detection 195<br />
error detection 195<br />
reading error tables 199<br />
U<br />
Unicode<br />
character sets 25<br />
UNIX<br />
starting <strong>Teradata</strong> T<strong>Pump</strong> 42<br />
syntax for invoking in batch mode 43<br />
UPDATE DML statement 70<br />
in script 70<br />
UPDATE keyword<br />
EXECUTE command 130<br />
UPDATE macro 131<br />
UPDATE SQL statement 31<br />
definition 92<br />
syntax 188<br />
upsert<br />
Atomic 125<br />
example 123<br />
feature 33, 123<br />
UPSERT keyword 33<br />
DML command 123<br />
EXECUTE command 130<br />
UPSERT macro 131<br />
USE keyword<br />
DML command 117<br />
use_field specification<br />
DML command 117<br />
username specification<br />
LOGON command 168<br />
USING (parms) specification<br />
IMPORT command 150<br />
USING keyword<br />
IMPORT command 150<br />
UTF-16<br />
character sets 26<br />
UTF16<br />
character sets 26<br />
utility variables<br />
supported by <strong>Teradata</strong> T<strong>Pump</strong> 62<br />
V<br />
-v 75<br />
-V runtime parameter 50<br />
-v runtime parameter 49<br />
var 93<br />
var specification<br />
SET command 183<br />
variables<br />
date and time<br />
date and time variables 60<br />
row count 61<br />
substitution 62<br />
utility<br />
supported by <strong>Teradata</strong> T<strong>Pump</strong> 62<br />
VARTEXTvariable-length text record format 151<br />
verbose mode runtime parameter 49<br />
VERBOSE runtime parameter 49<br />
version numbers 3<br />
W<br />
WHERE condition specification<br />
DELETE statement 111<br />
IMPORT command 153<br />
UPDATE statement 188<br />
Windows<br />
starting <strong>Teradata</strong> T<strong>Pump</strong> 42<br />
syntax for invoking in batch mode 43<br />
Z<br />
z/OS<br />
syntax for invoking in batch mode 44<br />
zoned decimal format 25<br />
<strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference 279
Index<br />
280 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference