Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Tue, 11 Jan 2011 @ 09:08:50 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: BTEQ Restart Logic
From:   Jinesh P V


Sorry for the delay, I dont check this email frequently.

  1. can you please let me know the path "bteq_restart_step.txt" file to be created.  

*** I would create the restart file in the same directory as the script, or give absolute path.

  2. If the process fails in the label sql1 then how it will be handled, since the statement ".if errorcode = 0 then .os echo '.goto sql2' > bteq_restart_step.txt;" starts only after the sql1.  

*** Due to some reason the lines got joined and got formatted incorrectly. I reformatted it below.

  3. Which statement should come first  

  Generally when any condition fails in the script, when it come across > the below statement i think it may exit from the program immediately.  

  .if errorcode <> 0 then .goto EXIT_ERROR;  

  how come the below statment will be executed?  

  .if errorcode = 0 then .os echo'.goto sql2' > bteq_restart_step.txt;  

*** If the SQL fails second if/then statement (.os echo) should not be executed. When you rerun after fixing the error it should rerun the failed SQL.

Please note that after each successful SQL it resets the restart point to next SQL#.

     .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;

     .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;

     .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;

     .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;

     .label sql5;

     DELETE FROM ${PQA_GSC_STG_DB}.table5; ---- sql5

     .os rm -f bteq_restart_step.txt;
     .quit 0;

     .label EXIT_ERROR;
     .quit 99;

  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023