File input/output is part of Short Circuit's Console Program Basics selection.
Task

Create a file called   "output.txt",   and place in it the contents of the file   "input.txt",   via an intermediate variable.

In other words, your program will demonstrate:

   how to read from a file into a variable
   how to write a variable's contents into a file


Oneliners that skip the intermediate variable are of secondary interest — operating systems have copy commands for that.




;
; File Input and output examples for DBL version 4 by Dario B.
; 
 
RECORD CUSTOM
 
CUCOD,  D5      ;customer code
CUNAM,  A20     ;name
CUCIT,  A20     ;city
,       A55
;------- 100 bytes -------------
 
A80,    A80
 
                       PROC
;--------------------------------------------------------------
 
        XCALL FLAGS (0007000000,1)      ;suppress STOP message
 
        CLOSE 1
        OPEN (1,O,'TT:')                ;open video
 
        CLOSE 2
        OPEN (2,O,"CUSTOM.DDF")         ;create file in output
 
        ;Add new record 
        CLEAR CUSTOM
        CUCOD=1
        CUNAM="Alan Turing"
        CUCIT="London"
        WRITES (2,CUSTOM)
 
        ;Add new record
        CLEAR CUSTOM
        CUCOD=2
        CUNAM="Galileo Galilei"
        CUCIT="Pisa"
        WRITES (2,CUSTOM)
 
        ;Modify a record
        CLOSE 2
        OPEN (2,U,"CUSTOM.DDF") [ERR=NOCUS]     ;open in update
        READ (2,CUSTOM,2)       [ERR=NOREC]
        CUCIT="Pisa - Italy"
        WRITE (2,CUSTOM,2)      [ERR=NOWRI]
 
        ;Add new record
        CLOSE 2
        OPEN (2,A,"CUSTOM.DDF") [ERR=NOCUS]     ;open in append
 
        CLEAR CUSTOM
        CUCOD=3
        CUNAM="Kenneth Lane Thompson"
        CUCIT="New Orleans"
        WRITES (2,CUSTOM)
        CLOSE 2
 
 
        ;Read file and display a video
        CLOSE 2
        OPEN (2,I,"CUSTOM.DDF")         [ERR=NOCUS]
        DO FOREVER
           BEGIN
                READS (2,CUSTOM,EOF)    [ERR=NOREC]
                DISPLAY (1,13,CUSTOM)
           END
EOF,    DISPLAY (1,10)
        CLOSE 2
 
        ;Write/read a text file
        CLOSE 3
        OPEN (3,O,"FILE.TXT")
        DISPLAY (3,"An Occurrence at Owl Creek Bridge",13,10)
        DISPLAY (3,"A man stood upon a railroad bridge in northern Alabama,",13,10)
        DISPLAY (3,"looking down into the swift water twenty feet below.",13,10)
        DISPLAY (3,"The man's hands were behind his back, the wrists bound ")
        DISPLAY (3,"with a cord.",13,10)
        CLOSE 3
 
        OPEN (3,I,"FILE.TXT")
        DO FOREVER
           BEGIN
                READS (3,A80,EOFF)
                DISPLAY (1,A80(1:%TRIM(A80)),10)
           END
EOFF,   CLOSE 3
        DISPLAY (1,10)
 
        GOTO QUIT
 
;---------------------------------------------------------------
NOCUS,  DISPLAY (1,10,"File CUSTUM.DDF Not found!",10)
        GOTO QUIT
NOREC,  DISPLAY (1,10,"Read error!",10)
        GOTO QUIT
NOWRI,  DISPLAY (1,10,"Write error!",10)
        GOTO QUIT
 
QUIT,   CLOSE 1
        STOP