It’s the object you are coping-to that is most critical
I would recommend that you ALCOBJ this checks and locks the objects.
for the To-File of *EXCL
and ALCOBJ from-file to *SHRRD
Monitor for the message: CPF1002 Cannot allocate object &1.
Make sure that you release the locks with DLCOBJ commands