Hi! newbie here.
I want to use something like bash aliases but into .BTQ scripts.
My idea is similar to:
--Aliases here
COLLECT STATISTICS ON STAGEP.INDICADOR_2 INDEX ( PK_KEY );
--Transform to
DECLARE vb1
DECLARE db1
SET vb1= 'INDICADOR_2'
SET db1='STAGEP'
COLLECT STATISTICS ON ${db1}.${vb1} INDEX (PK_KEY)
I hope you understand the idea. I know for sure my sintax is wrong, but you get the point.
Is this translation allowed? How can I type it?
Thanks in advance.
Solved! Go to Solution.
If you don't know perl, you can also write shell scripts or .bat scripts that accomplish this. For example, in Windows, Stats.bat looks like this:
@set vb1=%1
@set db1=%2
@echo .logon ...... > temp.btq
@echo COLLECT STATISTICS ON %db1%.%vb1% INDEX (PK_KEY) >> temp.btq
@echo ; >> temp.btq
@echo .quit >> temp.btq
bteq < temp.btq
@del temp.btq
Then do: stats.bat INDICADOR_2 STAGEP
As a UNIX shell script Stats.sh:
vb1="$1"
db1="$2"
bteq <<EOF
.logon ......
COLLECT STATISTICS ON $db1.$vb1 INDEX (PK_KEY)
;
.quit
EOF
Then do: stats.sh INDICADOR_2 STAGEP
Hi, for load_dates, we use metadata tables, for database names etc. we use some perl script which replaces %variablename%, %passwords% with value. So we have template bteq and something like compiled bteq. Also compiled bteq goes to secure folder, so only admin can see passwords.
When we desided this, bteq did not supported variables. I don't know if something had changed.
If you don't know perl, you can also write shell scripts or .bat scripts that accomplish this. For example, in Windows, Stats.bat looks like this:
@set vb1=%1
@set db1=%2
@echo .logon ...... > temp.btq
@echo COLLECT STATISTICS ON %db1%.%vb1% INDEX (PK_KEY) >> temp.btq
@echo ; >> temp.btq
@echo .quit >> temp.btq
bteq < temp.btq
@del temp.btq
Then do: stats.bat INDICADOR_2 STAGEP
As a UNIX shell script Stats.sh:
vb1="$1"
db1="$2"
bteq <<EOF
.logon ......
COLLECT STATISTICS ON $db1.$vb1 INDEX (PK_KEY)
;
.quit
EOF
Then do: stats.sh INDICADOR_2 STAGEP
I asume then, bteq scripts doesn't provide this function.
Thanks for your kind replys. I mark as solution GJColeman's post.