8 File Storage

Copying a File

The COPY statement is used to copy information from one DATA file into another file. Syntax for this statement is as follows:

COPY source file spec TO destination file spec

Execution of the COPY statement causes all records of a DATA file to be copied. A check of the name of the destination is made; an error is given if the name is already present. If not, a file of the same characteristics as the source file is created. The same directory can be both source and destination.

For example, this statement copies a file named DATA1 from the current volume to a new file named DATA2 on a volume labeled BACKUP:

The contents of a spool file, a file created by a previous printer assignment statement, are dumped to an output device, such as the display or a printer, by specifying only the source file spec in a COPY statement:

COPY source file spec

Use of spool files is covered in page 249 .

Eloquence Language Manual - 19 DEC 2002