Need to sum up a column value from multiple files into Credit and Debit categories using awk command

i have multiple files with Batch Header, Record detail & Batch trailer data in the files like :

BH 20150225950050N8262 
RD 20140918000000 99999999 unk Deferred Settlement -13950 
BT01 -13950 

Above sample data donot have the spaces coorectly defined. I do have multiple batch trailer records in 1 file.

Batch trailer holds the sum of data from all RD type records.(3 columns for Batch Trailer with 2,10,18 as column widths.)
I need to calculate the Sum of data in Batch Trailer from all files in Debit & CRedit category.
I tried below queries, but i donot get any output:

awk '{$1=='BT' && value=SUBSTR($1,13,30); if(value>0) {credit+=value}} END {print credit}' FIELDWIDTHS="2 10 18" AMT92015-02-25
 
awk ' {$0=='BT' &&
value=substr($0,13,30)
if(value>0) { plus+=value}
else {minus+=value}
}
END { print plus, minus} ' AMT*

Could you please help if i missed anything in my query.

When you can't show us correct spacing in your sample data when you are grabbing characters based on where those characters appear in a line, it is hard to help you.

When you pick 30 characters starting at offset 13 in a field that contains 2 characters (as in your 1st script), you aren't going to get much. When you only set value when an input line only contains the two characters BT and you don't have any lines that only contain those two characters (as in your 2nd script), you aren't going to get much either.

Is there some reason why you can't just use:

awk '
/^BT/ {	if($2 > 0)
		plus += $2
	else	minus += $2
} 
END {	print plus, minus
}' AMT*