You can create job variables and assign job variable values in two types of files:
Global Job Variables File: You can create a global job variables file to contain values for job variables. Every Teradata PT job automatically reads the global job variables file, if one exists. If there is a job variable used anywhere in the script, the job looks for the corresponding value in the global job variables file.A global job variables file is available on UNIX and Windows systems.
Local job variables file: You can also create a local job variables file to contain values for job variables. When the tbuild command specifies the -v option, the associated job reads the local job variables file. For example:
tbuild -f weekly_update.txt -v jobvars.txtOn z/OS, specify a local job variables file through the DDNAME of ATTRFILE.
The job variables file may be saved in ASCII, UTF-8, or UTF-16 encodings, both with and without a UTF byte order mark.
If possible, define known common job variables when you begin to employ Teradata PT. The use of job variables enhances the efficiency and security of job scripting. You can add additional job variable names and values when required.
Setting up variables requires two actions:
- Setting up script values to defer to local or global job variable values by specifying them using the form @<job variable name>, as follows:
VARCHAR TdpId = @MyTdpId, VARCHAR UserName = @MyUserName, VARCHAR UserPassword = @MyUserPassword
- Entering job variable assignments in the global job variables file and/or the local job variables file separated by commas, or one assignment per line without commas, in the form <job variable name>=’value’, as follows:
MyTdpId ='database1', MyUserName ='johndoe', MyUserPassword ='johndoe'
The location of the global job variables file and the local job variables file, as well as the name of the global and local job variables file, is user-definable in the context of the following:
- The user-defined path and filename of the global job variables file must put inside the twbcfg.ini file as an entry, as follows:
GlobalAttributeFile = '<userspath>/<usersGlobalJobVariablesName>'
- The user-defined path and filename of the local job variables files is specified after the -v option on the command line.
For further information on specifying job variables in the script, see Setting Up Job Variables.
For information on specifying job variables on the command line at job launch Assigning Job Variables on the Command Line.