can I pass awk variable to system command?

I wanna use a system function to deal with several data. So I use awk variable FILENAME to transfer the file directory to system command, but it does not work.

I use a shell function "out_function" to deal with data and save the result in another directory with the same file name.
How can I do it?
My code is as follows:
#try.awk

{system("./out_function FILENAME > ./dst/FILENAME")
print FILENAME
nextfile
}

I use command ---awk -f try.awk ./src/* --- to open data files. I found that system("
command") could not recongnize FILENAME, so it could not run correctly. How
ever, my test command--print FILENAME-- runs correctly.
How should I do to solve this problem? Thanks a lot.

You may want to try something like this. This code prints the filename from the directory specified on command line.

You can replace echo command with your function. awkvar2 file is:

NR==1{
print FILENAME;
}
"NR==1" is required to make it print the filename just once. BEGIN can't be used for the same because as per man page FILENAME variable isn't assigned a value till BEGIN block execution. What you need can be done without awk. This is just to display how to return variables to shell from awk.

Hope this helps.........

thank you for your remind. I realize it is shell programming.
now i use the following command:

for filename in *
do
../out_function $filename > ../dst/$filename
done

Thanks a lot.