Please enter your name. Find a copy in the library Finding libraries that hold this item Please enter the message. Please re-enter recipient e-mail address es. Tom Coffing Find more information about: Remember me on this computer. English View all editions and formats.
|Published (Last):||3 December 2012|
|PDF File Size:||19.35 Mb|
|ePub File Size:||16.63 Mb|
|Price:||Free* [*Free Regsitration Required]|
Copy ing Pr ohibit ed. The purpose of the SE is to provide a feature rich scripting tool. As the newer load and extract functionalities were being proposed for use with the Teradata RDBMS, it became obvious that certain capabilities were going to be needed by all the utilities. END Exit the utility.
IF command, allows multiple operations based on a conditional comparison. ELSE Optionally, perform an operation when a condition is not true. IF Compare variables and values to conditionally perform one or more operations. RUN Read and run commands stored in an external script file.
SET Establish or change a value stored in a variable. SYSTEM Allows for the execution of a command at the computers operating system level from within the script The SE allows the writer of the script to perform housekeeping chores prior to calling the desired utility with a.
At a minimum, these chores include the specification of the restart log table and logging onto Teradata. The rest of the commands are optional and only used when they satisfy a need. The following section in this chapter elaborates on the required commands. The optional commands are covered in later sections. Once the explanation and syntax is shown, an example of their use is shown in a script at the end of this chapter. Creating a Restart Log Table The Restart Log table is a mandatory requirement to run a utility that may need to perform a restart.
It is used by the utility to monitor its own progress and provide the basis for restart from the point of a failure. It is normally better to restart where the error occurred rather than rerunning the job from the beginning like BTEQ. The utilities use the restart log table to ascertain what type of restart, if any, is required as a result of the type of failure.
Failures can occur at a Teradata, network or client system level. The Restart log makes the process of restarting the utility very much automatic once the problem causing the failure has been corrected.
The syntax for creating a log table:. Creating Teradata Sessions Teradata will not perform any operation for a user who has not logged onto the system. It needs the user information to determine whether or not the proper privileges exist before allowing the operation requested. As a matter of performance, the utilities that use the SE look at the number of AMP tasks to determine the number of sessions to establish.
However, the number of sessions is configurable, but not as a part of the. Instead, setting the number of sessions to establish that is covered in the.
BEGIN paragraph next. The syntax for logging onto Teradata:. LOGON after the. Although a log table cannot be created until after a session is established, the. However, you will see a warning message displayed from the SE if the. LOGON command is issued first. So, it is best to make a habit of always specifying the. Once a session is established, based on privileges, the user can perform any of the following: n DDL n DCL n Any DML with the exception of SELECT n Establish system variables n Accept parameter values from a file n Perform dynamic substitution of values including object names Beginning a Utility Once the script has connected to Teradata and established all needed environmental conditions, it is time to run the desired utility.
This is accomplished using the. BEGIN command. Beyond running the utility, it is used to define most of the options used within the execution of the utility. As an example, setting the number of sessions is requested here. See each of the individual utilities for the names, usage and any recommendations for the options specific to it.
The syntax for writing a. BEGIN command:. To request the termination, use the. END command. END command:. It can then check the return code see Figure status and verify that the utility finished the task successfully. Based on the status value in the return code, the SE can be used to determine what processing should occur next. Terminating a Teradata Sessions Once the sessions are no longer needed, they also should to be ended.
To request their termination, use the. This value can then be checked by that system to determine conditional processing as a result of the completion code specified. They allow for additional processing within the preparation for the utility instead of requiring the user to access or other external tools.
As with the required commands above, an example of their use is shown in a script at the end of this chapter. Accepting a Parameter Value s Allowing the use of parameter values within the SE is a very powerful tool. A parameter can be substituted into the script much like the substitution of values within a Teradata macro.
However, it is much more elaborate in that the substitution includes the object names used in the SQL, not just data. When accepting one or more parameter values, they must be in a single record. If multiple records are needed, they can be read using multiple. Each record may contain one or more values delimited by a space.
Therefore, it is necessary to put character strings in single quotes. Once accepted by the script, these values are examined and are stored dynamically stored into parameters named within the script. When multiple values are specified on a single record, a space is used to delimit them from one another. The assignment of a value to a parameter is done sequentially as the names appear in the. The first value is assigned to the first parameter and so forth until there are no more parameter names in which to assign values.
The system variables are defined later in this chapter. They are automatically set by the system to provide information regarding the execution of the utility. For example, they include the date, time and return code, to name a few. Here they can be used to establish the value for a user parameter instead of reading the data from a file. Example of using a. This makes it easy to provide one parameter record that is used by multiple job scripts and allowing the script to determine which and how many of the values it needs.
To not use the integer data, the above. For example, for the above. When reading date data that does not match that format, it is rejected and stored in an error table. To ease the writing of the code by eliminating the need to specifically define the format of incoming dates, the. Normally, this technique is used to provide operational or informational output to the user regarding one or more conditions encountered during the processing of the utility or SE.
The message is normally built using a literal character string. However, a user may request the output to consist of substituted variable or parameter data. See the section below on using a variable in a script for more details.
The JCL must also contain any names, space requirements, record and block size, or disposition information needed by the system to create the file. Comparing Variable Data The. IF command is used to compare the contents of named variable data. Normally, a variable is compared to a known literal value for control purposes.
However, anything can be compared where it makes sense to do so. IF command:. ROUTE command is used to write messages to an output file. This is normally system information generated by the SE during the execution of a utility. ROUTE command:. The JCL must also contain any names, space requirements, record and block size, or disposition information needed by the system.
Running Commands from a File The. RUN command is used to read and execute other commands from a file. This is a great tool for using pre-defined and stored command files. This is especially a good way to secure your user id and password from being written into the script. In other words, you save your.
LOGON in a secured file that only you can see. Then, use the. RUN to access it for processing. In addition, more than one command can be put into the file. Therefore, it can add flexibility to the utility by building commands into the file instead of into the script. RUN command:. Setting Variables to Values The.
Tera-Tom on Teradata Utilities V12-V13
Tera-Tom on Teradata Utilities V12-V13 by Tera-Tom Coffing
TERA-TOM ON TERADATA UTILITIES V12-V13 PDF