Challenging!! Help needed

Hi,

I have a script xyz.ksh which accpets two parameters the format of first one is :X_TABLENAME_Y and second one is a digit. I can extract a table name from that parameter and store it in a variable var_tblnm, so if i pass a parameter X_TABLE1_Y the value in var_tblenm is "TABLE1"
now i have a function library where i've set some paths..like

function_lib:
export A_TABLE1_B="/home/user1/table1.txt"
export A_TABLE2_B="/home/user1/table2.txt"
export A_TABLE3_B="/home/user1/table3.txt"

the data in the files is as below:
table1.txt: 1001,JOHN,1000.00
table2.txt: 1002,JEFF,2000.50
table3.txt: 1003,LINDA,3000.50

now ..my problem is as below:
when i run my script 'xyz.ksh' and pass parameters as below:
$xyz.ksh X_TABLE2_Y 3
here my result should be 2000.50.i.e the third column of the table2.txt
..what i'm doing is as below ..which is not working !

var_data=${A_"${var_tblnm}"_B}
var_amt= `cat $var_data |cut -d ',' -f$2
print "$var_amt"...

i'm not able to get the output as 2000.50...
Please help

The following small shell script should show you what you need to know:

#!/usr/bin/ksh

A_TABLE2_B="table2.txt"
echo $A_TABLE2_B

var_tbl="TABLE2"
# note the "\$"
var_data="\$A_${var_tbl}_B"
echo $var_data

#and now use eval to get actual data file name 
var_file=$(eval echo $var_data)
echo $var_file

#var_amt=`cat $var_file | cut -d',' -f$2`
#echo $var_amt