Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 29 Sep 1999 @ 22:12:49 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: Using UNIX shell variables in Fastload
 
From:   Duncan Heard

It's easy!

Embed the fastload script within the shell script inside a here document as per the example below.

This would load the file /datadir/09291999.dat. This method can be used to replace anything in a script (fastload/mload/bteq/fexp) with the contents of a shell variable.

     --- snip ---

     #!/bin/ksh
     DATE_SHELL_VAR='09291999'

     fastload << !!END!! >> fload.log 2>&1

     LOGON dbc/userid, password;

     ERRLIMIT 50;
     BEGIN LOADING
        XXX.Customer_Temp1
        ERRORFILES
          XXX.Customer_Temp1_ERR1,
          XXX.Customer_Temp1_ERR2
          INDICATORS
          CHECKPOINT 100000;
     DEFINE
          IN_CardRef                        (INTEGER)
          FILE = /datadir/${DATE_SHELL_VAR}.dat;

     INSERT INTO XXX.Customer_Temp1
           (
            CardRef
      ) VALUES (
            :IN_CardRef
     );

     END LOADING;
     LOGOFF;

     !!END!!
     RETCODE=$?

     if [ "${RETCODE}" != 0 ]
     then
       exit 1
     fi

     --- snip ---

This is a very good method to use when you are running loads into development or production tables with the same script - put the database name into a shell variable and reference the variable in the load script rather than hardcoding the database name. It is also a good way to specify userids and passwords (but a ".run file" command is better still in my opinion)


Regards,

Duncan Heard
Data Warehouse Consultant
Retail Solutions Group
NCR Australia Pty. Ltd.



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023