How to pass filename as arguement to awk command?

Hi,
I am facing one issue. The awk command works fine if i hardcode the file name but if is pass it as an arguement it doesn't work. For e.g:Below commands works fine

awk -v A="$type" '{F=substr($0,23,8) "_LTD_" A ".txt"; print $0 >> F; close(F) }' RL004.txt

But the below command does not work.

awk -v A="$type" '{F=substr($0,23,8) "_LTD_" A ".txt"; print $0 >> F; close(F) }' $path/$filename

Can you please help with this.

What do echo $path and echo $filename say? What error message do you get when you run the awk command?

Earlier I wasn't getting any error, just that splitted files were not getting created.

The command worked fine once i ran the command after going to the directory where the file is present. It is not getting executed from any other path