Using a Here Document for Standard Input Files
In scenarios where environment variables need to be used as part of the BTEQ script, a Here document, which can be used to specify a string literal in a command-line shell, is a possible option.
The following example outlines a UNIX script as a Here document.
#!/bin/sh
#########################################
bteq <<EOI
export DATADIR=/datasvc/data
.LOGON mydbs/myid,mypw;
.EXPORT REPORT FILE=$DATADIR/output
SELECT * from table_name;
.EXPORT RESET
.LOGOFF
.EXIT
EOI
#########################################