|
Archives of the TeradataForumMessage Posted: Fri, 23 Oct 2015 @ 09:23:58 GMT
<-- Anonymously Posted: Thursday, October 22, 2015 01:25 --> Hi, I want bteq output to be displayed on stdout and also be logged to a file using unix 'tee' command. Also I intend to check the bteq return code and take necessary action. Here is the code snippet - ***************************************************** bteq << EOF | tee bteq_log_file .logon td1/user1,passwd; select count(*) from table; .IF errorcode <> 0 .GOTO ERROR; .LABEL ERROR .QUIT 99 .LOGOFF .QUIT EOF RETURN_CODE=$? if [ $RETURN_CODE -ne 0 ] then exit $RETURN_CODE fi ***************************************************** When bteq throws an error the return code check below is not working because it is in effect evaluating the return code of the 'tee' command (which is the last command to be executed after bteq) and not evaluating the return code of the bteq, which executes before 'tee'. Is there any way to circumvent this problem ? I want to display the output of bteq on stdout and redirect to a file and also check the return code of bteq (and not that of tee). Please advise. Thanks
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||