Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,41 +0,0 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Main is
|
||||
subtype Block is String (1 .. 80);
|
||||
Infile_Name : String := "infile.dat";
|
||||
outfile_Name : String := "outfile.dat";
|
||||
Infile : File_Type;
|
||||
outfile : File_Type;
|
||||
|
||||
Line : Block := (Others => ' ');
|
||||
begin
|
||||
Open (File => Infile, Mode => In_File, Name => Infile_Name);
|
||||
Create (File => outfile, Mode => Out_File, Name => outfile_Name);
|
||||
|
||||
Put_Line("Input data:");
|
||||
New_Line;
|
||||
while not End_Of_File (Infile) loop
|
||||
Get (File => Infile, Item => Line);
|
||||
Put(Line);
|
||||
New_Line;
|
||||
for I in reverse Line'Range loop
|
||||
Put (File => outfile, Item => Line (I));
|
||||
end loop;
|
||||
end loop;
|
||||
|
||||
Close (Infile);
|
||||
Close (outfile);
|
||||
|
||||
Open(File => infile,
|
||||
Mode => In_File,
|
||||
Name => outfile_name);
|
||||
New_Line;
|
||||
Put_Line("Output data:");
|
||||
New_Line;
|
||||
while not End_Of_File(Infile) loop
|
||||
Get(File => Infile,
|
||||
Item => Line);
|
||||
Put(Line);
|
||||
New_Line;
|
||||
end loop;
|
||||
end Main;
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
*> Rosetta Code, fixed length records
|
||||
*> Tectonics:
|
||||
*> cobc -xj lrecl80.cob
|
||||
identification division.
|
||||
program-id. lrecl80.
|
||||
|
||||
environment division.
|
||||
configuration section.
|
||||
repository.
|
||||
function all intrinsic.
|
||||
|
||||
input-output section.
|
||||
file-control.
|
||||
select infile
|
||||
assign to infile-name
|
||||
organization is sequential
|
||||
file status is infile-status
|
||||
.
|
||||
select outfile
|
||||
assign to outfile-name
|
||||
organization is sequential
|
||||
file status is outfile-status
|
||||
.
|
||||
|
||||
data division.
|
||||
file section.
|
||||
fd infile.
|
||||
01 input-text pic x(80).
|
||||
|
||||
fd outfile.
|
||||
01 output-text pic x(80).
|
||||
|
||||
working-storage section.
|
||||
01 infile-name.
|
||||
05 value "infile.dat".
|
||||
01 infile-status pic xx.
|
||||
88 ok-input value '00'.
|
||||
88 eof-input value '10'.
|
||||
|
||||
01 outfile-name.
|
||||
05 value "outfile.dat".
|
||||
01 outfile-status pic xx.
|
||||
88 ok-output value '00'.
|
||||
|
||||
procedure division.
|
||||
|
||||
open input infile
|
||||
if not ok-input then
|
||||
display "error opening input " infile-name upon syserr
|
||||
goback
|
||||
end-if
|
||||
|
||||
open output outfile
|
||||
if not ok-output
|
||||
display "error opening output " outfile-name upon syserr
|
||||
goback
|
||||
end-if
|
||||
|
||||
*> read lrecl 80 and write the reverse as lrecl 80
|
||||
read infile
|
||||
perform until not ok-input
|
||||
move function reverse(input-text) to output-text
|
||||
|
||||
write output-text
|
||||
if not ok-output then
|
||||
display "error writing: " output-text upon syserr
|
||||
end-if
|
||||
read infile
|
||||
end-perform
|
||||
|
||||
close infile outfile
|
||||
|
||||
*> from fixed length to normal text, outfile is now the input file
|
||||
open input outfile
|
||||
if not ok-output then
|
||||
display "error opening input " outfile-name upon syserr
|
||||
goback
|
||||
end-if
|
||||
|
||||
read outfile
|
||||
perform until not ok-output
|
||||
display function trim(output-text trailing)
|
||||
read outfile
|
||||
end-perform
|
||||
|
||||
close outfile
|
||||
|
||||
goback.
|
||||
end program lrecl80.
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
*> Rosetta Code fixed length records, text to Forth block
|
||||
identification division.
|
||||
program-id. blocking.
|
||||
|
||||
environment division.
|
||||
configuration section.
|
||||
repository.
|
||||
function all intrinsic.
|
||||
|
||||
input-output section.
|
||||
file-control.
|
||||
select infile
|
||||
assign to infile-name
|
||||
organization is line sequential
|
||||
file status is infile-status
|
||||
.
|
||||
select outfile
|
||||
assign to outfile-name
|
||||
organization is sequential
|
||||
file status is outfile-status
|
||||
.
|
||||
|
||||
data division.
|
||||
file section.
|
||||
fd infile.
|
||||
01 input-text pic x(64).
|
||||
|
||||
fd outfile.
|
||||
01 output-text pic x(64).
|
||||
|
||||
working-storage section.
|
||||
01 infile-name.
|
||||
05 value "forth.txt".
|
||||
01 infile-status pic xx.
|
||||
88 ok-input value '00'.
|
||||
88 eof-input value '10'.
|
||||
|
||||
01 outfile-name.
|
||||
05 value "forth.blk".
|
||||
01 outfile-status pic xx.
|
||||
88 ok-output value '00'.
|
||||
|
||||
procedure division.
|
||||
|
||||
*> read a line, padded to or truncated at 64 as defined in FD
|
||||
open input infile
|
||||
if not ok-input then
|
||||
display "error opening input " infile-name upon syserr
|
||||
goback
|
||||
end-if
|
||||
|
||||
open output outfile
|
||||
if not ok-output
|
||||
display "error opening output " outfile-name upon syserr
|
||||
goback
|
||||
end-if
|
||||
|
||||
move 0 to tally
|
||||
read infile
|
||||
perform until not ok-input
|
||||
move input-text to output-text
|
||||
|
||||
write output-text
|
||||
if not ok-output then
|
||||
display "error writing: " output-text upon syserr
|
||||
end-if
|
||||
|
||||
add 1 to tally
|
||||
if tally > 15 then move 0 to tally end-if
|
||||
|
||||
read infile
|
||||
end-perform
|
||||
|
||||
*> Output up to next 1024 byte boundary
|
||||
if tally > 0 then
|
||||
compute tally = 16 - tally
|
||||
move spaces to output-text
|
||||
|
||||
perform tally times
|
||||
write output-text
|
||||
if not ok-output then
|
||||
display "error writing: " output-text upon syserr
|
||||
end-if
|
||||
end-perform
|
||||
end-if
|
||||
|
||||
close infile outfile
|
||||
|
||||
goback.
|
||||
end program blocking.
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
*> Rosetta Code fixed length records, Forth blocks to text.
|
||||
identification division.
|
||||
program-id. unblocking.
|
||||
|
||||
environment division.
|
||||
configuration section.
|
||||
repository.
|
||||
function all intrinsic.
|
||||
|
||||
input-output section.
|
||||
file-control.
|
||||
select infile
|
||||
assign to infile-name
|
||||
organization is sequential
|
||||
file status is infile-status
|
||||
.
|
||||
select outfile
|
||||
assign to outfile-name
|
||||
organization is line sequential
|
||||
file status is outfile-status
|
||||
.
|
||||
|
||||
data division.
|
||||
file section.
|
||||
fd infile.
|
||||
01 input-text pic x(64).
|
||||
|
||||
fd outfile.
|
||||
01 output-text pic x(64).
|
||||
|
||||
working-storage section.
|
||||
01 infile-name.
|
||||
05 value "forth.blk".
|
||||
01 infile-status pic xx.
|
||||
88 ok-input value '00'.
|
||||
88 eof-input value '10'.
|
||||
|
||||
01 outfile-name.
|
||||
05 value "forth.txt".
|
||||
01 outfile-status pic xx.
|
||||
88 ok-output value '00'.
|
||||
|
||||
procedure division.
|
||||
|
||||
open input infile
|
||||
if not ok-input then
|
||||
display "error opening input " trim(infile-name) upon syserr
|
||||
goback
|
||||
end-if
|
||||
|
||||
open output outfile
|
||||
if not ok-output
|
||||
display "error opening write " trim(outfile-name) upon syserr
|
||||
goback
|
||||
end-if
|
||||
|
||||
*> read a fixed length line, 64 characters
|
||||
read infile
|
||||
perform until not ok-input
|
||||
move trim(input-text) to output-text
|
||||
|
||||
write output-text
|
||||
if not ok-output then
|
||||
display "error writing: " output-text upon syserr
|
||||
end-if
|
||||
read infile
|
||||
end-perform
|
||||
|
||||
close infile outfile
|
||||
|
||||
goback.
|
||||
end program unblocking.
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
inp: open %infile.dat
|
||||
out: open/new %outfile.dat
|
||||
|
||||
while [ not empty? line: copy/part inp 80 ][ write out reverse line ]
|
||||
|
||||
close inp
|
||||
close out
|
||||
Loading…
Add table
Add a link
Reference in a new issue