How to call unix commands with in the BTEQ script?

Database
Enthusiast

How to call unix commands with in the BTEQ script?

Hi ,

Could anyone help in how can I write unix commands with in the Bteq script?I am failing and the below is the error msg I am getting:

sh: -c : line 1 : syntax error : unexpected end of file

here is what I am trying to do....Much appreciated if you have solution for this..

vi abcd.sh

if [[ cond1 ]]

then 

if [[ cond2 ]]

then

bteq<< !

xx

ddd

.export file =cond3

sel ----

.os if [[ cond3 -ge 100 ]]

.os then 

.echo " don't proceed"

.os else 

.export file =file.txt

sel --

.export reset

.os fi

.quit

!

fi

else

echo "welcome"

fi

3 REPLIES
Enthusiast

Re: How to call unix commands with in the BTEQ script?

Never done that but historically I've done it the other way around:

#/bin/ksh

bteq << EOF

.bt

${shell_var}

.et

EOF

I'm not actually answering your question but this might be a work around.

Enthusiast

Re: How to call unix commands with in the BTEQ script?

Hi

I guess you cant use if statement inside a BTEQ.

.OS is used only to execute UNIX commands inside BTEQ and if is not a command. u can try

if  [ cond1 ]

then 

    if  [ cond2 ]

    then

           bteq<< !

           xx

          ddd

          .export file =cond3

          sel ----

        .quit

!

        . export filename(cond3)

        if [ cond3 -ge 100 ]

        then 

               echo " don't proceed"

        else 

               bteq<< !

               xx

              ddd

              .export file =file.txt

              sel --

             .export reset

            .quit

!

       fi

   fi

else

  echo "welcome"

fi

N/A

Re: How to call unix commands with in the BTEQ script?

how to connect teradata to informatica?

and unix to teradata?