Bteq IF ELSE STATEMENT

Tools & Utilities

Bteq IF ELSE STATEMENT

Hi,
Any cone could u please help me the below one............

SEL C1,Count(*) from T1 GROUP BY 1;
.IF ERRORCODE<>THEN .QUIT
SEL * from T2 where Status='F';
.IF ACTIVITYCOUNT >0 THEN .QUIT 99

logoff
.QUIT
.QUIT 99

Note: T2 contains the Failed Records.
if a=0 then i would like to execute the next IF statement and ultimately it fails with the return code 99.
if a=1 then i would like to execute the SQL and i want to exit normally with Return code 0.
where a is a varible and every time it has been set manually.
1 REPLY
Enthusiast

Re: Bteq IF ELSE STATEMENT

Your requirement is not too clear, and you do not give your environment, but the following should help:

You do not say what type of variable a is; I assume below it is a shell variable
and is set in Unix/ Linux before the script is called.

SEL C1,Count(*) from T1 GROUP BY 1;
.IF ERRORCODE<> 0 THEN .QUIT

Select $a Where $a = 1;
.If ActivityCount = 1 Then .Goto NoCheck

SEL * from T2 where Status='F';
.IF ACTIVITYCOUNT >0 THEN .QUIT 99

.Label NoCheck

.Quit 0