I want to copy a load module from one pds to another using REXX.
-
1Have you tried reading the documentation for [IEBCOPY](https://www-01.ibm.com/support/knowledgecenter/#!/SSLTBW_2.1.0/com.ibm.zos.v2r1.idau100/iebcopy.htm) and [allocating datasets in REXX](https://www-01.ibm.com/support/knowledgecenter/#!/SSLTBW_2.1.0/com.ibm.zos.v2r1.ikjc300/create.htm)? – cschneid Dec 07 '15 at 12:41
3 Answers
You could invoke IEBCOPY from within a Rexx, allocating the appropriate datasets to the appropriate ddnames before invoking IEBCOPY.
I'm unable to provide an example as I don't have the facilities/access.
Note that doing so may tie up your terminal/session.
You could also go into a more elaborate solution to build and submit a batch job, perhaps even having a panel front end, driving file tailoring/skeletons.

- 51,415
- 16
- 49
- 68
As @cshneid said you can use IEBCOPY Using IEBCOPY in rexx is basically the same as in JCL but:
- use TSO Alloc to allocate the files
- Call/invoke the program
if running under ISPF you can use LMCOPY. Roughly the following should work, you may need to issue a LMOPEN / LMClose on the data-ids as well ???
Address ISPEXEC
'LMINIT DATAID(DIDFrom) Dataset(in.data.set)'
'LMINIT DATAID(DIDTo) Dataset(to.data.set)'
'LMCOPY FromId('DIDFrom') FROMMEM(mymem) toId('DIDTo') toMem(newMemberName)'
'LMFREE DATAID(DIDFrom)'
'LMFREE DATAID(DIDto)'
If running foreground, the ISPF services used to have the advantage as they "co-ordinated" there actions with all other ISPF users- Less likely to corrupt the PDS directory. Not sure if this is an advantage any more.

- 10,358
- 1
- 27
- 38
-
For a load module, stay away from IEBGENER/SORT Copy/IDCAMS repro. There is a lot of information in the PDS directory entry that will not get copied. They also do not work with PDSEs (program objects); the only way to copy them is with IEBCOPY, or programs that use IEBCOPY under the covers (ISPEXEC LMCOPY). There is an internal system call (used by IEBCOPY), but to get documentation, you have to pay a fabulous (probably now 6 digits to the left of the decimal point) amount to get a book called DFSMS Advanced Customization. – zarchasmpgmr Dec 08 '15 at 23:18
-
its load module, and the pds needs to be of U format so LMCOPY is not working .... – monkey Dec 11 '15 at 17:57
Using just REXX what you want to do is not possible, however, you can invoke IEBCOPY (or your site equivalent) to perform the task for you. You may want to investigate calling programs like IEBCOPY and passing it the appropriate control cards to perform your task.