identification division.
program-id. filetext.
* aus Wirth, systematisches Programmieren p. 107
author. "JD".
date-written. 25.10.2004.
date-compiled.
environment division.
input-output section.
file-control.
select f assign to file-f
status f-status.
select g assign to file-g
status g-status.
data division.
file section.
fd f
record contains 120 characters
data record is f-record
label record is omitted.
01 f-record.
05 c pic x.
fd g
record contains 120 characters
data record is g-record
label record is omitted.
01 g-record.
05 c pic x.
working-storage section.
78 lmax pic 9(4) value 100.
77 w pic 9(4).
77 l pic 9(4).
77 i pic 9(4).
77 f-status pic S9(4) comp.
77 g-status pic S9(4) comp.
77 blanc pic x value space.
77 ch pic x.
77 crlf pic x(2) value x'1013'.
procedure division.
move 0 to l
open input f
output g
read f into f-record
perform readword
perform writeword
perform until f-status <= 0
read f into f-record
perform readword
if l+w < lmax then
write g-record from blanc
add 1 to l
else
write g-record from crlf
move 0 to l
end-if
perform writeword
end-perform.
write g-record from crlf
close f g
stop run.
readword.
move 0 to w
perform until ch = ' '
add 1 to w
move ch to z(w)
read f into f-record
end-perform.
writeword.
perform varying i from 1 by 1 until i >= w
write f-record from z(i)
* all w to l
end-perform.
end-program filetext.
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
|
Haftungshinweis
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.
|