CL Command Reference - CPYDOC
CL Command List > CPYDOC Reference
Description:
The Copy Document (CPYDOC) command allows you to copy a document from one folder into another folder or to copy a document that is not in a folder into a folder.
Restrictions:
. If you are replacing a document in a folder, you must have change (*CHANGE) authority to that document.
. If you are creating a new document in a folder, you must have *CHANGE authority to that folder. The new document will have the same authorization as the document from which it is copied.
. You must have use (*USE) authority to the document being copied.
Examples:
Example 1: Copying a Document
CPYDOC FROMDOC(MYDOC) FROMFLR(MYFLR)
TODOC(MYDOC2) TOFLR(MYFLR2)
REPLACE(*YES)
This command copies document MYDOC located in folder MYFLR to document MYDOC2 located in folder MYFLR2. If document MYDOC2 already exists in MYFLR2, the system replaces it with a copy of document MYDOC; otherwise, MYDOC2 is created in MYFLR2 as a copy of MYDOC in MYFLR.
Example 2: Copying Document and Keeping Source Document Name
CPYDOC FROMDOC(*SYSOBJNAM) SYSOBJNAM(AMBT133080)
TODOC(MYDOC4) TOFLR(MYFLR)
This command copies a document, identified by the system object name, to document MYDOC4 located in folder MYFLR. The document name will be the same as the name of the source document.
Example 3: Copying Document to Document in Same Folder
CPYDOC FROMDOC(XYZ) FROMFLR(¡¯MYFLR/TEST¡¯) TODOC(NEW)
This command copies document XYZ located in folder MYFLR/TEST to document NEW in the same folder. If document NEW already exists, an error message is sent.