16.20 - Setting Up Job Variables - Parallel Transporter

Teradata® Parallel Transporter User Guide

Product
Parallel Transporter
Release Number
16.20
Published
August 2020
Language
English (United States)
Last Update
2020-08-27
dita:mapPath
uah1527114222342.ditamap
dita:ditavalPath
Audience_PDF_product_tpt_userguide_include.ditaval
Job variables can be set up in the following locations:
  • In the job script itself: The lowest priority for supplying values for job variables is specifying them inside the job script itself. Use the optional SET directive before the DEFINE JOB statement, for example:
    SET MyTdpId = 'database1';
    	SET MyUserName = 'johndoe';
    	SET MyUserPassword = 'johndoe';
    
    	DEFINE JOB CREATE_SOURCE_EMP_TABLE
        (
    	  DEFINE OPERATOR DDL_OPERATOR
    	  DESCRIPTION 'Teradata Parallel Transporter DDL Operator'
    	  TYPE DDL
    	  ATTRIBUTES
    	  (
    		VARCHAR TdpId = @MyTdpId,
    		VARCHAR UserName = @MyUserName,
    		VARCHAR UserPassword = @MyUserPassword
    	  );
    
    	  APPLY
    	    ('DROP TABLE SOURCE_EMP_TABLE;'),
    	    ('CREATE TABLE SOURCE_EMP_TABLE(EMP_ID INTEGER, EMP_NAME
    	CHAR(10));'),
    		('INSERT INTO SOURCE_EMP_TABLE(1,''JOHN'');'),
    		('INSERT INTO SOURCE_EMP_TABLE(2,''PETER'');')
          TO OPERATOR (DDL_OPERATOR);
    	);
  • Global job variables file: The next lowest priority for supplying values for job variables is storing them inside the global job variables file. The global job variables file is read by every Teradata PT job. Place common, system-wide job variables in this file, then specify the path of the global job variables in the Teradata PT configuration file by using the GlobalAttributeFile parameter. An example global job variables file would contain the following text:
    MyTdpId    = 'database1',
    MyUserName = 'johndoe',
    MyUserPassword = 'johndoe'
    A global job variables file is available on UNIX and Windows systems.
  • Local job variables file: The second highest priority and most common method for defining values for job variables is storing them inside a local job variables file. You can specify a local job variables file, which contains the values for job variables, using the -v option on the command line as follows:
    tbuild -f weekly_update.txt -v jobvars.txt
    For example, the jobvars.txt file might contain the following text:
    MyTdpId    = 'database1',
    MyUserName = 'johndoe',
    MyUserPassword = 'johndoe'
    Also, many job variable files may be declared on the command line for a script:
    tbuild -f weekly_update.txt -v jobvars_def.txt -v jobvars_user_info.txt
    For example, the jobvars_def.txt file might contain the following text:
          SourceFileName = 'flatfile1.dat',
          Format = 'delimited',
          TextDelimiter  = '|',
          SourceOpenMode = 'Read'

    And, the jobvars_user_info.txt file might contain the following text:

          MyTdpId = 'database1',
          MyUserName = 'johndoe',
          MyUserPassword = 'johndoe'
    • Multiple job variable files declared on command line will behave as one large job variable.
    • When defining multiple job variable files, all files have equivalent priority source values, as described in the note in Using Job Variables. Redefinition of a job variable in multiple files is considered an error by Teradata PT.
    • On z/OS, specify a local job variables file through the DDNAME of ATTRFILE.
  • On the command line: The highest priority method for defining values for job variables is passing them in as arguments on the command line using the -u option. For example:
    tbuild -f weekly_update.txt -u "MyTdpId = 'database1', MyUserName = 'johndoe', MyUserPassword = 'johndoe'"

    For further information on specifying job variables on the command line, see Assigning Job Variables on the Command Line.

For more information, see Setting Up the Job Variables Files.