With dynamic filename assignment, the filename is specified in the SELECT clause as a COBOL data item:
select filename
assign to dynamic data-item
where the parameters are:
Example
In the following example, the file input.dat is created in the current directory:
...
select fd-in-name
assign to dynamic ws-in-file.
...
working-storage section.
01 ws-in-file pic x(30).
...
move "input.dat" to ws-in-file.
...
open output fd-in-name.