|
Archives of the TeradataForumMessage Posted: Mon, 22 Feb 2011 @ 01:14:09 GMT
Setting errorlevel resets the severity which informs the return code set by BTEQ at termination and signalled back to the calling OS/script. In effect, every BTEQ/Teradata errocode has a default errorlevel (the severity) - In the absence of any .set errorlevel commands the highest severity corresponding to any errorcode encountered during the script is the return code returned by BTEQ at completion. It is not the errorcode that is returned by BTWQ to calling script/os but this errorlevel (severity) unlkess one explicily peforms a QUIT n. Typically it is 0,4,8,12,16. The code/errorlevel assignments are listed in the BTEQ manual - if an errocode is not listed then the errorlevel is 8 . One can automattcially terminate BTEQ early by setting MAXERROR to say 8 but in the absence of MAXERROR BTEQ continues until end of script or an explicit .QUIT n. So, in your script you have overrudden the default erorrlevel of 8 for errorcode 3807 to 0 This will have no effect except to ensure that your script ends with a return code of zero if no other errors are encountered. The script continues and then performs your .IF ERRORCODE <> 0 test. As the ERRORCODE is 3807 you have decided to QUIT and set the reurtn code to 20 explicitly. What do you want to do?. Ignore the error and continue? If so, remove the .IF ERRORCODE test. If you want to stop immediately but with return code zero (don't think you want to do this but . . ) then change to .IF ERRORCODE <> 0 THEN QUIT 0. Do you want to terminate immediatlely on any 3807? If so, set MAXERROR to 0 and .SET ERRORLEVEL 3807 SEVERITY 1 but this will complete with return code 1. Otherwise you will have remove the MAXERROR and test after each statement for the errorcode <> 0 and do a QUIT 0 if you still want to exit with return code 0. Best to read BTEQ Manual and experiment as it easy to get the setting of these interactions behaving differently from intuition (or memory as above for that matter). Regards Andy Baker
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||