Hi, I am trying to use Teradata fastexport in ksh, but getting error as below
temp1.ksh: line 7: syntax error at line 10: `newline' unexpected
below is my code:
#!/bin/ksh
LOGON_STR="TDDB/user,paswd;"
DATAFILE=/path/a.lst;
DEBUG=0
>$DATAFILE
fexp > /dev/null 2>&1 <
.logon ${LOGON_STR}
.LOGTABLE DATABASE.FExp_Log;
.BEGIN EXPORT
.EXPORT OUTFILE ${DATAFILE};
SELECT
'"'|| TRIM(col A)
||'"'||','||'"'||TRIM(col B)
||'"'||','||'"'||TRIM(col C)
||'"'||','||'"'||TRIM(col D)
||'"'||','||'"'||TRIM(col E)
||'"'||','||'"'||TRIM(col F)
FROM table;
.EXPORT RESET;
.LOGOFF;
.QUIT;
Pls suggest
kshji
2
You trying HERE input ?
syntax is
cmdline <<EndOfInputString
data
EndOfInputString
# ex.
cmdline <<EOF
data
EOF
1 Like
Hi,
I am not trying any input. I am getting the specified error on the .logon statement. I removed the
> /dev/null 2>&1 <
next to the fexp. so it started running. but I am not getting any output, so after waiting fr 1 hour ,I had to killed the process.
If you are not trying any input, what is this?
logon ${LOGON_STR}
.LOGTABLE DATABASE.FExp_Log;
.BEGIN EXPORT
.EXPORT OUTFILE ${DATAFILE};
SELECT
'"'|| TRIM(col A)
||'"'||','||'"'||TRIM(col B)
||'"'||','||'"'||TRIM(col C)
||'"'||','||'"'||TRIM(col D)
||'"'||','||'"'||TRIM(col E)
||'"'||','||'"'||TRIM(col F)
FROM table;
.EXPORT RESET;
.LOGOFF;
.QUIT;
It doesn't get fed into the program unless you ask it to feed it into the program.
You do that with this:
program ... <<EOF
logon ${LOGON_STR}
.LOGTABLE DATABASE.FExp_Log;
.BEGIN EXPORT
.EXPORT OUTFILE ${DATAFILE};
SELECT
'"'|| TRIM(col A)
||'"'||','||'"'||TRIM(col B)
||'"'||','||'"'||TRIM(col C)
||'"'||','||'"'||TRIM(col D)
||'"'||','||'"'||TRIM(col E)
||'"'||','||'"'||TRIM(col F)
FROM table;
.EXPORT RESET;
.LOGOFF;
.QUIT;
EOF