Paasing shell script variables in to BTEQ script

General
Enthusiast

Paasing shell script variables in to BTEQ script

Hi,

I have shell script which has set of variables which iam reading from a parameter file

read CUST_CORE CUST_STG CUST_SAND  < ${WORKDIR}/ida_td_usg_load.prm

export CUST_CORE

export CUST_STAGE

export CUST_SANDBOX

I have to write a BTEQ script which I will be passign as a paramter to the above  shell script and I want to use all the above 3 variables in my BTEQ script . What is the best method to achieve this?

Thanks,

Radha

3 REPLIES
Enthusiast

Re: Paasing shell script variables in to BTEQ script

If I understand you correctly, is this waht you mean?:

#!/usr/bin/ksh

export CUST_CORE

export CUST_STAGE

export CUST_SANDBOX

bteq<<! >>${LOG_FILENAME} 2>&1

.logon yourip/username,password

<you can use the parameters here>

!

<then unix script again>

Enthusiast

Re: Paasing shell script variables in to BTEQ script

No I have a shell script names execTDSQL.sh  which has the following variables defined

read CUST_CORE CUST_STG CUST_SAND  < ${WORKDIR}/ida_td_usg_load.prm export CUST_CORE

export CUST_STAGE

export CUST_SANDBOX

I have another BTEQ script  abc.sql I want use the the above variables in the bTEQ script  and pass the bteq script as a first paramter to the shell script and it should be able to replace the variables with the actual database name.

sh execTDSQL.sh abc.sql

Enthusiast

Re: Paasing shell script variables in to BTEQ script

I see your export does not have values.

 Why cant you stuff sql inside the sh, example below:

export DB_NAME=abc

export DB_USER_NAME=def

bteq<<! >>$PWD/abf.log 2>&1

.logon ${DB_NAME}/${DB_USER_NAME},don't_tell_anyone

.run file $HOME/abc.sql

.quit

!