This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -0,0 +1,48 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. file-io.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT in-file ASSIGN "input.txt"
ORGANIZATION LINE SEQUENTIAL.
SELECT OPTIONAL out-file ASSIGN "output.txt"
ORGANIZATION LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD in-file.
01 in-line PIC X(256).
FD out-file.
01 out-line PIC X(256).
PROCEDURE DIVISION.
DECLARATIVES.
in-file-error SECTION.
USE AFTER ERROR ON in-file.
DISPLAY "An error occurred while using input.txt."
GOBACK
.
out-file-error SECTION.
USE AFTER ERROR ON out-file.
DISPLAY "An error occurred while using output.txt."
GOBACK
.
END DECLARATIVES.
mainline.
OPEN INPUT in-file
OPEN OUTPUT out-file
PERFORM FOREVER
READ in-file
AT END
EXIT PERFORM
END-READ
WRITE out-line FROM in-line
END-PERFORM
CLOSE in-file, out-file
.

View file

@ -0,0 +1,2 @@
*> Originally from ACUCOBOL-GT
CALL "C$COPY" USING "input.txt", "output.txt", 0

View file

@ -0,0 +1,2 @@
*> Originally from Micro Focus COBOL
CALL "CBL_COPY_FILE" USING "input.txt", "output.txt"

View file

@ -1,7 +1,7 @@
declare in file, out file;
open file (in) title ('/INPUT.TXT,type(text),recsize(100)') input;
open file (out) title ('/OUTPUT.TXT,type(text),recsize(100) output;
open file (out) title ('/OUTPUT.TXT,type(text),recsize(100') output;
do forever;
get file (in) edit (line) (L);
put file (out) edit (line) (A);

View file

@ -1,6 +1,21 @@
import java.nio.file._
import java.io.{ FileNotFoundException, PrintWriter }
val input = Paths.get("input.txt")
val output = Paths.get("output.txt")
object FileIO extends App {
try {
val MyFileTxtSource = scala.io.Source.fromFile("input.txt")
val MyFileTxtTarget = new PrintWriter("output.txt")
Files.copy(input, output)
val str = MyFileTxtSource.mkString
MyFileTxtTarget.print(str)
MyFileTxtTarget.close()
MyFileTxtSource.close()
}
} catch {
case e: FileNotFoundException => println(e.getLocalizedMessage())
case e: Throwable => {
println("Some other exception type:")
e.printStackTrace()
}
}
}