All Forums Database
ysrinu 44 posts Joined 04/07
29 Feb 2012
Compare strings in bteq statement, not in sql

Hi,

i have a bteq statement and depending on the unix environment variable ${JOB_ENV} i want to skip to a lable

bteq < EOF

${LOGON};

.label A

----------

...

.if errorlevel <> 0 then .quit 1

.if '${JOB_ENV}' = 'tst' then .goto C

 

.label B

----------

...

.label C

----------

.....

 

I get this error on running (unix variable JOB_ENV is set to 'tst')

   .if 'tst' = 'tst' then .goto C
 *** Error: Did not recognize the variable ''.

How can i do string comparison at .if statement without having to do in a sql statement?

Thanks,

-srinivas yelamanchili

ulrich 816 posts Joined 09/09
29 Feb 2012

Will not work this way. According to the BTEQ manual (see attached jpg)

.if is limited to conditions on ERRORCODE, ERRORLEVL and ACTIVITYCOUNT.

So you can't compare strings as you like.

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

ulrich 816 posts Joined 09/09
29 Feb 2012

You might use the following

select 'OK' from sys_calendar.calendar where calendar_date = current_date and 'tst' = '${JOB_ENV}';

.if Activitycount = 1 then .goto C

 

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

klnsreenivas 12 posts Joined 12/11
04 Dec 2012

i need to check in BTEQ like
Select length(Employee_Name) from Employee where Employee_id=155;
but length is not working, is there any way to calculate the string length.
Length is ODBC commend.
 
Please guide me

K.L.N.Sreenivas

mohan.mscss 31 posts Joined 04/11
04 Dec 2012

try with char(Employee_Name)...

klnsreenivas 12 posts Joined 12/11
05 Dec 2012

ok I found solution like
Select char_Length(Employee_name) from where Employee_id=155;
 
this way its working

K.L.N.Sreenivas

You must sign in to leave a comment.