Copy a member to a USS file with cp //'HLQ.SRC(MEM)'
Copy a PDS member into a z/OS UNIX file with cp "//'HLQ.SRC(MEM)'", quoting the name so the shell keeps its single quotes.
In the z/OS UNIX shell, a dataset is reached with a leading //, and the name goes in single quotes. The shell strips quotes it sees, so wrap the whole thing in double quotes.
cp "//'USER1.SRC.COBOL(PROG1)'" /u/user1/prog1.cbl
ls -l /u/user1/prog1.cbl-rw-r--r-- 1 USER1 SYS1 560 Nov 23 10:12 /u/user1/prog1.cblWithout the double quotes the shell removes the single quotes, and the name is then treated as being under your TSO prefix, so cp cannot find it. With the quotes, //'...' is a fully qualified name. If you drop the quotes and the inner single quotes, //SRC.COBOL(PROG1) is expanded with your prefix added.
The data is converted from EBCDIC to the file's code page only when it is treated as text, which is covered in the cp -T and cp -B snippets. A PDS member copy takes the member only, so copy every member with a loop when you need all of them. This applies to the z/OS 3.1 UNIX System Services shell.