COPY
Makes a copy of a member, or a whole library, in another library.
Why it matters. You test a change in DEV, then copy it on to TEST. COPY is how work moves along without being typed again.
Syntax
COPY 'from-dsname[(member)]' 'to-dsname[(member)]' (MF/OS only) ISPF option 3.3 (Move/Copy). Batch: IEBCOPY with the control statement COPY OUTDD=ddname,INDD=ddname
- from-name
- The library or member to copy from. Quote it.
- to-name
- The library to copy into. It must already exist.
- (member) on the from name
- Copy that one member. With no member, every member is copied.
- (member) on the to name
- Give the copy a new member name.
- Replace like-named members
- An ISPF 3.3 option. Without it, members with the same name in the target are left alone.
Try it COPY
- 1
Copy the member NOTES from your DEV.JCL library into your TEST.JCL library.
COPY 'ZB0001.DEV.JCL(NOTES)' 'ZB0001.TEST.JCL(NOTES)' - 2
Now copy every member of DEV.JCL into TEST.JCL at once.
COPY 'ZB0001.DEV.JCL' 'ZB0001.TEST.JCL'
Remember
- Two names: from, then to. The original stays where it is.
- A member in brackets copies one. No brackets copies the whole library.
- Both libraries must already exist, and you need access to both.
The usual mistake
COPY 'ZB0001.DEV.JCL(NOTES)' 'ZB0001.TEST.NEWLIB'
The library you copy to must exist first. MF/OS says it is not in the catalog and copies nothing.
Make the library with ALLOCATE first, then COPY into it
On real z/OS
COPY is not a TSO command. It stands in for ISPF option 3.3 or IEBCOPY. MF/OS replaces a member with the same name in the second library without asking, while ISPF 3.3 does that only if you choose Replace like-named members.
Where can I practise COPY?
Right here, at ZedBank. You take a junior job at a simulated bank and use COPY in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- DatasetWhat a mainframe calls a file: a named collection of records with a defined structure, rather than a loose stream of bytes.
- Partitioned datasetA dataset that works like a library or folder, holding many separately named members inside one dataset.
- MemberOne named item inside a partitioned dataset, such as a single program, job or copybook within a library.
- High-level qualifierThe first part of a dataset name, which usually identifies the owner and drives how security and storage rules apply.
- TSOTime Sharing Option: the interactive login environment on z/OS, where you get a command prompt and a session of your own.