Command reference / ifs
COPY
Copy Object
Copies IFS objects to a new path or directory. COPY is another name for CPY.
Allowed environments: *ALL.
Positional parameters: 2.
Parameters
OBJ
Object
Enter the IFS path or name pattern identifying the source objects.
TODIR
To directory
Enter an existing destination directory. Each copied object keeps its original name.
.- The object is copied to the current directory with the same name as the existing object.
directory-path-name- Enter the path name of the existing directory to copy the object into.
TOOBJ
To object
Enter the destination path, including the new object name.
SYMLNK
Symbolic link
Choose whether a symbolic link is copied as a link or resolved to its target before copying.
Allowed values:
*NO, *YES
*NO- Follow the link and copy its target.
*YES- Copy the link itself when the source is a symbolic link.
FROMCCSID
From CCSID
Sets the method for obtaining the coded character set identifier (CCSID) for the source of the copy operation. This CCSID will be used for data conversion, if requested. This parameter can not be specified with the From code page (FROMCODPAG) or To code page (TOCODEPAGE) parameters.
Suggested / special values:
*OBJ, *PCASCII, *JOBCCSID
*OBJ- Use the data CCSID of the object to be copied.
*PCASCII- Use the data CCSID of the object to be copied to compute a CCSID in the Microsoft Windows encoding scheme (x4105) (Microsoft, Windows, Windows NT, and the Windows 95 logo are registered trademarks of Microsoft Corporation).
*JOBCCSID- The CCSID from the default job CCSID is used.
1-65533- Enter a CCSID value.
TOCCSID
To CCSID
Sets the data coded character set identifier (CCSID) for the target of the copy operation. This parameter is ignored if the object specified on the Object (OBJ) parameter is not a regular file. A regular file is a file that supports the integrated file system input/output (I/O) operations open, read, and write. This parameter can not be specified with the From code page (FROMCODPAG) or To code page (TOCODEPAGE) parameters.
Suggested / special values:
*OBJ, *CALC, *STDASCII, *PCASCII, *JOBCCSID
*OBJ- Use the data CCSID of the object to be copied. If this CCSID cannot be used by the file system that the object is to be copied into, the copy operation will fail.
*CALC- Use the data CCSID of the object to be copied. If this CCSID cannot be used by the file system that the object is to be copied into, allow the file system to determine a different CCSID and continue with the copy.
*STDASCII- Compute a CCSID in the IBM PC Data encoding scheme (x2100), based on the source file's CCSID. Associate this CCSID for the target of the copy operation and, if DTAFMT(*TEXT) is specified, also use this CCSID for the data conversion.
*PCASCII- Compute a CCSID in the Microsoft Windows encoding scheme (x4105), based on the source file's CCSID (Microsoft, Windows, Windows NT, and the Windows 95 logo are registered trademarks of Microsoft Corporation).
*JOBCCSID- The CCSID from the default job CCSID is used.
1-65533- Enter a CCSID value.
DTAFMT
Data format
Choose whether the copy treats data as bytes or as text to be converted.
Allowed values:
*BINARY, *TEXT
*BINARY- The file contains data in binary format (such as an executable file). Do not convert data on the copy.
*TEXT- The file contains data in textual form. Convert data to the CCSID of the new object during the copy. The data is processed as text during the copy.
SUBTREE
Directory subtree
Choose whether to copy a directory subtree if the object specified by Object (OBJ) parameter is a directory.
Allowed values:
*NODIR, *NONE, *ALL
*NODIR- Copy object or objects specified by OBJ.
*NONE- Omit objects specified by OBJ are copied. Directory objects are copied but their contents.
*ALL- Copy objects specified by OBJ.
REPLACE
Replace object
Controls whether the target object is replaced if it already exists.
Allowed values:
*NO, *YES
*NO- The target object is not replaced if it already exists.
*YES- If the target object already exists, it is replaced. If REPLACE(*YES) is specified with a directory object, the attributes of the existing target directory are changed but the objects that the directory contains are not removed.
OWNER
Owner
Sets the owner of the newly created object.
Allowed values:
*NEW, *KEEP
*NEW- The owner of the new object is the current user profile of the job.
*KEEP- The owner of the new object is the same as the owner of the original object to be copied. Some file systems do not support changing the owner of certain object types.
AUT
Authority
Sets the method used to assign authority information to copied objects.
Allowed values:
*OBJ, *INDIR, *INDIROBJ
*OBJ- The authority information for copied objects is based on the authority for the object specified on the Object (OBJ) parameter.
*INDIR- The authority information for copied objects is based on the authority for the directory where the objects are to be created.
*INDIROBJ- The authority information for copied objects is initially based on the authority for the directory where the objects are to be created.
FROMCODPAG
From code page
Sets the method for obtaining the code page for source of the copy operation. This code page will be used for data conversion, if requested. This parameter can not be specified with the From CCSID (FROMCCSID) or To CCSID (TOCCSID) parameters.
Suggested / special values:
*OBJ, *PCASCII
*OBJ- Use the data code page of the object to be copied.
*PCASCII- Use the data code page of the object to be copied to compute a code page in the Microsoft Windows encoding scheme (x4105) (Microsoft, Windows, Windows NT, and the Windows 95 logo are registered trademarks of Microsoft Corporation).
1-32767- Enter a code page value.
TOCODEPAGE
To code page
Sets the data code page for the target of the copy operation. This parameter is ignored if the object specified on the Object (OBJ) parameter is not a regular file. A regular file is a file that supports the integrated file system input/output (I/O) operations open, read, and write. This parameter can not be specified with the From CCSID (FROMCCSID) or To CCSID (TOCCSID) parameters.
Suggested / special values:
*OBJ, *CALC, *STDASCII, *PCASCII
*OBJ- Use the data code page of the object to be copied. If this code page cannot be used by the file system that the object is to be copied into, the copy operation will fail.
*CALC- Use the data code page of the object to be copied. If this code page cannot be used by the file system that the object is to be copied into, allow the file system to determine a different code page and continue with the copy.
*STDASCII- Compute a code page in the IBM PC Data encoding scheme (x2100), based on the source file's code page.
*PCASCII- Compute a code page in the Microsoft Windows encoding scheme (x4105), based on the source file's code page.
1-32767- Enter a code page value. If this code page cannot be used by the file system that the object is to be copied into, the copy operation will fail.
Examples
COPY OBJ('DECEMBER-1994-MONTHLY-PAYROLL-FILE') TOOBJ('PAY')
Creates another file named PAY that is a duplicate of the file named DECEMBER-1994-MONTHLY-PAYROLL-FILE.
COPY OBJ('PAY') TODIR('MYDIR')
Creates another file named PAY in directory MYDIR.
COPY OBJ('SL1') TOOBJ('YOURDIR/SL2') SYMLNK(*YES)
If SL1 is a symbolic link, the new object YOURDIR/SL2 is also a symbolic link.
COPY OBJ('/DATAFB') TOOBJ('/QSYS.LIB/APP1.LIB/DATA.FILE/DATAFB.MBR') TOCCSID(*CALC) DTAFMT(*TEXT)
Copies stream file 'DATAFB' to the database file 'DATAFB.MBR'.
COPY OBJ('/QDLS/MYINFO') TODIR('/myfolder') SUBTREE(*ALL) OWNER(*KEEP) REPLACE(*YES)
The *FLR object (QDLS file system folder) is created in the '/myfolder' directory in the "root" (/) file system with the path name '/myfolder/MYINFO'. Its contents are copied as well.
COPY OBJ('PAY') TODIR('MYDIR') AUT(*INDIR)
Creates another file named PAY in directory MYDIR.
Generated from os/cl/catalog/COPY.json and os/cl/help/COPY.json.