You've to use name expression by enclousing variable into parenthesis.
COPY TO (lfilename ) ...
It's not recomended to use the SYS(3) function because it can return duplicate values on fast computers.
>STORE SYS(03) + ".csv" TO lfilename
>COPY TO lfilename TYPE DELIMITED WITH "" WITH CHARACTER "|"
>
>but the name the file become lfilename.txt
>
>so how can i have the value inside lfilename for the name of the file
--sb--