I'm trying to copy a text file from within the z/OS unix shell to a PDS titled P2.OUTPUT($010), but whenever i run the command cp file.txt "//P2.OUTPUT($010)" i get an error stating that P2.OUTPUT(-sh10) is an invalid location. For whatever reason, whenever I run the command $010 becomes -sh10. I've tried putting $010 in '' and a few other things but no matter what I do it doesn't seem to work. I believe it's an issue with accessing the file and not with the cp command because I can't view the contents of the member using the cat command either, and any error trying to access the member using any command lists it as -sh10 instead of $010. Any idea what I'm doing wrong?
The problem is that the unix shell interprets $0
as an environment-variable that has the value -sh
as can be seen when using echo $0
, so your command becomes cp file.txt "//P2.OUTPUT(-sh10)"
.
Try escaping the $
using a backslash: cp file.txt "//P2.OUTPUT(\$010)"
.