File Name Specification on the COPY Statement
Only one file can be specified in the copy operation. If the file does not exist when copying to a file, it is created.
Windows: If the file exists, COPY overwrites it. When specifying a file name, always enclose it in single quotation marks. Omit the drive and directory portion of the file name if the file is in the current directory. Otherwise, provide a full path name with drive and directory. The following example shows a full path name; this is an example of unformatted copying (see
Unformatted Copying):
COPY emp() FROM 'D:\users\fred\emp.lis';
Linux: If the file exists, COPY overwrites it. When specifying a file name, always enclose it in single quotation marks. Omit the full path name if the file is in the current directory. Otherwise, provide a full path name. The following example shows a full path name; this is an example of unformatted copying (see
Unformatted Copying):
COPY emp() FROM '/usr/fred/emp.lis';
IMPORTANT! The COPY statement is not able to expand $HOME or recognize the Linux variables set in your environment. Do not use these variables to specify a path name for the COPY statement. For example, the following COPY statements do not work:
COPY emp () FROM '~fred/emp.lis'; /* invalid */
COPY emp () FROM '$HOME/emp.lis'; /* invalid */ Last modified date: 04/03/2024