Bteq script error handling not working

Analytics

Bteq script error handling not working

bteq <<EOF > $LogfileName 2>&1

.logmech LDAP;

.logon $SRVR/$ID,$PSWD;

.set errorlevel on;

SELECT

STATUS FROM

(

SELECT status,start_date,END_DATE, RANK() OVER ( PARTITION BY CAST( END_DATE AS DATE FORMAT 'MM-DD-YYYY') ORDER BY END_DATE DESC) RNK

FROM MKT.MARTTRANSACTION WHERE REPORT_MART_NAME='x'

AND CAST( END_DATE AS DATE FORMAT 'MM-DD-YYYY')=CURRENT_DATE

QUALIFY RNK=1

) tmp

where STATUS=1;

.IF ACTIVITYCOUNT = 1 THEN .GOTO Exec_Stats;

.IF ACTIVITYCOUNT = 0 THEN .GOTO Exit_Bteq;

.LABEL Exec_Stats

COLLECT STATISTICS MKT.ACTIVITY COLUMN ACTV_TYPE;

 

 

.LABEL Exit_Bteq

.REMARK '****Todays Aprimo MIS Run has not Completed Successfully Yet...Exiting the bteq**** ';

.IF ERRORCODE = 0 THEN .GOTO Exec_count;

.IF ERRORCODE > 0 THEN .GOTO Exit_Bteq;

.LABEL Exec_count

bteq <<EOF >> $LogfileName 2>&1

 .export report file = ${scriptdir}/Aprimo_MIS_Count.txt;

select count(*) from table1;

.QUIT ERRORCODE;

.REMARK '****Todays Aprimo MIS count has not Completed Successfully ...Exiting the bteq**** ';

 

.QUIT 20

.LOGOFF;

EOF

2 REPLIES
Senior Apprentice

Re: Bteq script error handling not working

And your problem is?

Guessing: GOTO can only skip forward, but not back.

Why are there two bteq <<EOF?

Re: Bteq script error handling not working

The error handling is not happening properly. sure i will change the GOTO statement and see.