identification division.
program-id. fileconvto.
* aus Wirth, systematisches Programmieren p. 100
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.
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.
working-storage section.
78 n pic 9(4) value 100.
77 u pic 9(4).
77 i pic 9(4).
77 a pic 9(4) occurs n.
77 x pic 9(4)V9(4).
77 num pic 9(4)V9(4).
77 f-status pic S9(4) comp.
linkage section.
77 e pic 9(4)V9(4).
procedure division using e.
* 0 <= e < 10**n
move 0 to i
move e to x
perform until x = 0
* a1*10**0+ ... +ai*10*+(i-1)+10**i=e
divide x by 10 giving u
add 1 to i
compute a(i) = x - 10*u
move u to x
end-perform.
open output f
perform until i = 0
compute c = function rep(a(i))
write f-record
subtract 1 from i
end-perform.
close f
end-program fileconvto.
¤ Dauer der Verarbeitung: 0.18 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.
|