COPY |
![]() ![]() ![]() |
The COPY command copies selected records from one file to another, or within the same file.
Format
COPY FROM {DICT} src.file {TO {DICT} tgt.file} {src.rec{,tgt.rec}} {options}
where
Any number of source and target record pairs may be specified. If all records in the file are to be copied, the keyword ALL may be used in place of specified record names.
If no source records are specified and the default select list is active, this list is used to determine the records to be copied. A confirmation prompt is issued before copying commences unless the NO.QUERY keyword is used.
The COPY command does not normally overwrite existing records. The keyword OVERWRITING allows this operation. Thus a command of the form COPY FROM src.file TO tgt.file ALL would only copy records that do not already exist in the target file.
Conversely, the keyword UPDATING copies records only if they already exist in the target file.
The DELETING keyword causes COPY to delete records from the source file after they have been successfully copied to the target file.
The REPORTING keyword causes a message to be displayed for each record copied.
@SYSTEM.RETURN.CODE is returned as the number of records copied or a negative error code.
Example
COPY FROM NEWVOC TO VOC ALL OVERWRITING
This command copies all records from the NEWVOC file to the VOC, replacing existing records of the same name. This could be used, for example, if the VOC had been damaged by an accidental deletion of some standard records.
See also: |