BTEQ error exists, but RC=0

Tools
Teradata Employee

BTEQ error exists, but RC=0

Hi all,

 

I have an issue with BTEQ. Here is my very simple script:

 

.logon 192.168.133.128/dbc,dbc

.run file="C:\\some\\not\\existing\\path\\my.sql";
.IF ERRORCODE > 0 THEN .QUIT 1;

 .quit ERRORCODE;

When I execute this via "bteq -c UTF8 < pathtoscript" it shows me the log:

 

 

 *** Error: Open failed because: No such file or directory
+---------+---------+---------+---------+---------+---------+---------+----
.IF ERRORCODE > 0 THEN .QUIT 1;
+---------+---------+---------+---------+---------+---------+---------+----

 .quit ERRORCODE;
 *** You are now logged off from the DBC.
 *** Exiting BTEQ...
 *** RC (return code) = 0

So, error exists, but RC =0. At the same time if I try to do echo %ERRORLEVEL% in same terminal it shows me 0. Means BTEQ really exited with 0 RC.

 

What is wrong with my script? How can I get normal (meaning non-zero) RC if script I'm trying to execute really does not exist?

  • bteq
5 REPLIES
Teradata Employee

Re: BTEQ error exists, but RC=0

Nothing "wrong" with your script.

ERRORCODE and ERRORLEVEL (severity) only apply to Teradata database errors.

BTEQ does not provide a way to test for non-fatal client-side script errors.

Teradata Employee

Re: BTEQ error exists, but RC=0

Should I parse the output to find out about such client-side errors, or there are a more proper way to do this?

Supporter

Re: BTEQ error exists, but RC=0

how about checking that the file exists before starting bteq in a shel script?

Teradata Employee

Re: BTEQ error exists, but RC=0

That is just 1 possible error of thousands. Mature utilities usually can report those kind of "client-side" problems also. Looks like BTEQ after 20+ years of existence not there yet

Supporter

Re: BTEQ error exists, but RC=0

As you saw the reporting was not the issue - the log was showing you the info. I guess you expected a different action.

 

I can only guess that this behavior was not implemented due to a lazy decision. BTEQ runs on all kind of OS…

 

But you are free to use a different client – if your internal IT does support this…

I found the Teradata python module - http://developer.teradata.com/tools/reference/teradata-python-module#Connectivity - very nice and would like to see more TD customers to use it.