BTEQ exits with Wrong Error code

Hi,

My bteq script has an update statement. semicolon is missing at the end of the update statement and the update fails. but the bteq is returning error code '0'. so am unable to catch the error when my process runs. i have a label defined 'SQLERROR' and am using . IF ERRORCODE<>0 then .GOTO SQLERROR. so when the update fails, it should go to SQLERROR label and exit with .quit 50, but thats not happening. It exits with ERRORCODE=0. below is my code. can anyone help me with it.

Re: BTEQ exits with Wrong Error code

what do you mean by last statement. ? Update statement is the last statement right. If the update is not running succesfully, it should go to SQLERROR label and exit with return code 50 right. correct me if am wrong.

Re: BTEQ exits with Wrong Error code

and in my actual script , there is only 1 update statement. in this sample sript which i attached i have a create table statement and an update statement. If y]you are saying that 'create table' statement is the last statement that ran succesfully, then in my original script there is no create table statement. It just has an update statement with a missing colon and that error is not being caught.