substr problem in KSH

in my script i have a command which will sum a particular value of all the lines in a file not beginning with H or T .
I have given the following commands

-------------------------------------------------------------
RCRD_CTRL_VAL_1_SUM=`awk '/^[^HT]/{ SUM+=substr($0,${TRLR_CTRL_VAL_1[0]},${TRLR_CTREL_VAL_1[1]})}END {printf "%015.2f", SUM}'
$FILE_NAME`

where the array values
TRLR_CTRL_VAL_1[0] =98 and
TRLR_CTRL_VAL_1[1] =10 ( the positions of the amount to be summed )

but this is thrwoing an error :-
Syntax Error The source line is 1.
The error context is
/^[^HT]/{ >>> SUM+=substr($0,${ <<<
awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.
awk: 0602-500 Quitting The source line is 1.

pls tell me the solution .

do i have to intialize the position and length values in BEGIN?

The shell variables, ${TRLR_CTRL_VAL_1[0]} and ${TRLR_CTREL_VAL_1[1]} are not expanded in the awk script. Pass them as variables.

... awk -v v1=${TRLR_CTRL_VAL_1[0]} -v v2=${TRLR_CTREL_VAL_1[1]} '/^[^HT]/{ SUM+=substr($0,v1,v2)}END {printf "%015.2f", SUM}' ...

I am still getting the same error message even after doing so

I tried the following command but still for the same message
-------------------------------------------------------------

Now replace awk with nawk.

I have to use AWK only

Some versions of awk won't allow variables so you can try this:

awk '/^[^HT]/{ SUM+=substr($0,'${TRLR_CTRL_VAL_1[0]}','${TRLR_CTREL_VAL_1[1]}')}END {printf "%015.2f", SUM}'

Notice the additional single quotes surrounding your variables.