How to return BTEQ and Fastload error codes to Unix

Tools & Utilities
Enthusiast

How to return BTEQ and Fastload error codes to Unix

I am running fastload scripts and BTEQ scripts from a UNIX shell script. Everything was going fine until I inserted a test to make sure there was a return code of 0. My fastload script, in the fastload output, showed a return code of 0 but Unix is picking up 1. My BTEQ script is, deliberately, falling over with a return code of 8 but is returning 0 to Unix. How can I make BTEQ and Fastload pass their return codes to UNIX?

This is the part of my shell script that is picking up a 1 from a complete OK fastload script

fastload < $vScriptName
if (($? != 0))
echo 'error ' $? ' in fastload script'
then vErrorText="script $vScriptNameSuffix failed"
ShowError
fi

Here is the end of the output that shows 0 is the return code but 1 is coming back to UNIX.

. Highest return code encountered = '0'.
**** 16:42:22 FDL4818 FastLoad Terminated
error 1 in fastload script
Error: script FLOAD_DIM_BRANCH.txt failed

Many thanks for any help,

Susan
3 REPLIES
Teradata Employee

Re: How to return BTEQ and Fastload error codes to Unix

Check you logic the if then fi should enclose the fail message

fastload<x
if (($? != 0))
then
echo fail
else
echo ok
fi
Enthusiast

Re: How to return BTEQ and Fastload error codes to Unix

bteq << EOF
.logon $SERV/$USER,$PASS
database $DBN;
.RUN FILE=$SDIR/A.txt;
.logoff
.quit
EOF

#****** Check for Return code ********#

if [[ $rc != 0 ]]
then
exit $rc
fi
Enthusiast

Re: How to return BTEQ and Fastload error codes to Unix

Thanks for both responses - apologies for my basic error - penalties of trying to do something too quickly.

Regards,

Susan