Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
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:
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
FROMDOC | From document | Character value, *SYSOBJNAM | Required, Positional 1 |
FROMFLR | From folder | Character value, *NONE | Optional, Positional 2 |
TODOC | To document | Character value, *FROMDOC | Optional, Positional 3 |
TOFLR | To folder | Character value, *FROMFLR | Optional, Positional 4 |
REPLACE | Replace document | *NO, *YES | Optional |
SYSOBJNAM | System object name | Name | Optional |
Top |
Specifies the name of the document being copied.
This is a required parameter.
If FROMDOC(name) is specified, a folder name must be specified on FROMFLR.
If FROMDOC(*SYSOBJNAM) is specified, then SYSOBJNAM(name), TODOC(name) and TOFLR(name) must be specified.
Top |
Specifies the name of the folder that contains the document that is copied.
Top |
Specifies the output document name.
If TODOC(*FROMDOC) is specified, then TOFLR(*FROMFLR) cannot be specified.
If FROMDOC(*SYSOBJNAME) is specified, then TODOC(name) must be specified.
Top |
Specifies the folder into which the output document is copied.
If FROMDOC(*SYSOBJNAME) is specified, then TOFLR(name) must be specified.
Top |
Specifies whether the document specified on TODOC can be replaced.
Top |
Specifies the system object name. This parameter is valid only when DLO(*SYSOBJNAM) is specified.
Top |
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.
Top |
Top |