動的ファイル名割り当ての例

 select fd-in-name
     assign to dynamic ws-in-file.
  ...
 select fd-out-name
     assign to dynamic ws-out-file.
  ...
 working-storage section.
 01 ws-in-file  pic x(30) value "input.dat".
 01 ws-out-file pic x(40).
  ...
 procedure division.
     accept ws-out-file.
     open input fd-in-name fd-out-name
  ...

この例では、現在のディレクトリのファイル input.dat と ws-out-file の現在の値で指定されたファイルが開きます。