Yolanda,
Based on your partial code listing, I think you are using the substitution
variable {filename.dat} without defining it, although you would have gotten
an error when you ran the SQR.
Not sure what is your substitution variable {filename.dat} is defined as,
But here are two was of accomplishing it:
do create_file