RosettaCodeData/Task/File-input-output/COBOL/file-input-output-1.cobol

41 lines
1.1 KiB
Text
Raw Permalink Normal View History

2018-06-22 20:57:24 +00:00
identification division.
program-id. copyfile.
environment division.
input-output section.
file-control.
select input-file assign to "input.txt"
organization sequential
2013-10-27 22:24:23 +00:00
.
2018-06-22 20:57:24 +00:00
select output-file assign to "output.txt"
organization sequential
2013-10-27 22:24:23 +00:00
.
2018-06-22 20:57:24 +00:00
data division.
file section.
fd input-file.
1 input-record pic x(80).
fd output-file.
1 output-record pic x(80).
working-storage section.
1 end-of-file-flag pic 9 value 0.
88 eof value 1.
1 text-line pic x(80).
procedure division.
begin.
open input input-file
output output-file
perform read-input
perform until eof
write output-record from text-line
perform read-input
end-perform
close input-file output-file
stop run
2013-10-27 22:24:23 +00:00
.
2018-06-22 20:57:24 +00:00
read-input.
read input-file into text-line
at end
set eof to true
end-read
.
end program copyfile.