All Forums Analytics
archanag 2 posts Joined 10/14
09 Oct 2014
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
 
 

dnoeth 4628 posts Joined 11/04
09 Oct 2014

And your problem is?
 
Guessing: GOTO can only skip forward, but not back.
Why are there two bteq <<EOF?

Dieter

archanag 2 posts Joined 10/14
09 Oct 2014

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

You must sign in to leave a comment.