select output-file
assign to external evar
organization is line sequential.
...
fd output-file
record contains 80 characters.
01 output-file-record pic x(80).
...
procedure division.
open output output-file.
write output-file-record from "c:\dir\file".
...
close output-file.
stop run.
If, before running the above code, the following command is issued:
set evar=">cmd /c print"
then each WRITE operation on output-file is passed as input to the print command.