![]() |
|
Archives of the TeradataForumMessage Posted: Thu, 29 Sep 1999 @ 22:12:49 GMT
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
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||