The logic involved maintaining a file (say bteq_restart_step.txt) which will have the name of the step from where the BTEQ has to be restarted.
Every Time a step completes the label name for the next step is written into the file.
So next time to submit the BTEQ it skips the step that were already executed and starts running from the next one.
At the end of the BTEQ we delete that file.
Note that for writing and deleting the file we are using the BTEQ OS command.
Every Time a step completes the label name for the next step is written into the file.
So next time to submit the BTEQ it skips the step that were already executed and starts running from the next one.
At the end of the BTEQ we delete that file.
Note that for writing and deleting the file we are using the BTEQ OS command.
.logon
${PTD_TDP}/${PTD_DB_USER},${PTD_DB_PASSWD};
.run
file bteq_restart_step.txt;
.label
sql1;
DELETE FROM ${PQA_GSC_DCM_DB}.table1; ---- sq11
.if errorcode <> 0 then .goto EXIT_ERROR;
.if errorcode = 0 then .os echo '.goto sql2' > bteq_restart_step.txt;
DELETE FROM ${PQA_GSC_DCM_DB}.table1; ---- sq11
.if errorcode <> 0 then .goto EXIT_ERROR;
.if errorcode = 0 then .os echo '.goto sql2' > bteq_restart_step.txt;
.label
sql2;
DELETE FROM ${PQA_GSC_DCM_DB}.table2; ---- sql2
.if errorcode <> 0 then .goto EXIT_ERROR;
.if errorcode = 0 then .os echo '.goto sql3' > bteq_restart_step.txt;
DELETE FROM ${PQA_GSC_DCM_DB}.table2; ---- sql2
.if errorcode <> 0 then .goto EXIT_ERROR;
.if errorcode = 0 then .os echo '.goto sql3' > bteq_restart_step.txt;
.label
sql3;
DELETE FROM ${PQA_GSC_STG_DB}.table3; ---- sql3
.if errorcode <> 0 then .goto EXIT_ERROR;
.if errorcode = 0 then .os echo '.goto sql4' > bteq_restart_step.txt;
DELETE FROM ${PQA_GSC_STG_DB}.table3; ---- sql3
.if errorcode <> 0 then .goto EXIT_ERROR;
.if errorcode = 0 then .os echo '.goto sql4' > bteq_restart_step.txt;
.label
sql4;
DELETE FROM ${PQA_GSC_STG_DB}.table4; ---- sql4
.if errorcode <> 0 then .goto EXIT_ERROR;
.if errorcode = 0 then .os echo '.goto sql5' > bteq_restart_step.txt;
DELETE FROM ${PQA_GSC_STG_DB}.table4; ---- sql4
.if errorcode <> 0 then .goto EXIT_ERROR;
.if errorcode = 0 then .os echo '.goto sql5' > bteq_restart_step.txt;
.label
sql5;
DELETE
FROM ${PQA_GSC_STG_DB}.table5; ---- sql5
.os rm
-f bteq_restart_step.txt;
.quit 0;
.quit 0;
.label
EXIT_ERROR;
.quit 99;
.quit 99;
(courtesy: Teradata forum)
No comments:
Post a Comment