having trouble with basic bteq and ksh

Database
Enthusiast

having trouble with basic bteq and ksh

I'm a ksh and bteq rookie here and i'm trying to get a basic variable to store. My code is this, but when I run it, I just get a new line beginning with ">"...it doesn't seem to actually run the code though...can someone help me please...

testvar1=$(bteq << EOF 2>&1
.LOGON db/user,pass
DATABASE schema:
SEL CURRENT_DATE;
.LOGOFF;
.QUIT;
.EXIT
EOF)
echo "The date is: " $testvar1

2 REPLIES
Enthusiast

Re: having trouble with basic bteq and ksh

nvm...got it to work...so now my output is this not just the date queried back...but everything, like login successfull message, database version message, character set message, etc...how do I get just the query results back?

Enthusiast

Re: having trouble with basic bteq and ksh

Hey k1ng ,  

If my understanding of ur query is correct You need to exoport the data into a file . Below example will help .

.LOGON localtd/dbc,dbc;

bteq << EOF

.EXPORT FILE = C:\TX\out.txt;

.SET SEPARATOR '|'

SEL CURRENT_DATE;

.LOGOFF

.EXIT