error handling in Bteq

Tools & Utilities

error handling in Bteq

HI I am new to teradata, executing sql scripts through BTEQ In a Shell script, how can I catch the error
thrown by sql and pass it to shell script so that the script stops execution.

below is my script.

in_file=$1;
in_name=$2;
in_user=$3;
in_pass=$4;

file_sfx=log
add_dt=`date '+%Y_%m_%d_%H%M%S'`

bteq<<-[EOF]
.SET ERROROUT STDERR;
.logon $in_name/$in_user,$in_pass;

.run file=$in_file;
.logoff;
.quit
[EOF]