There seem to be some TSO issues as well as REXX issues. As a first step, run 
with trace i and see whether things expand the way you're expecting. There are 
several places where you refer to variables you have not defined. Also, you 
seem to be expecting ALLOC to return a ddname. 


-- 
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3
עַם יִשְׂרָאֵל חַי
נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר




________________________________________
From: IBM Mainframe Discussion List <[email protected]> on behalf of 
[email protected] <[email protected]>
Sent: Tuesday, December 16, 2025 11:39 AM
To: [email protected] <[email protected]>
Subject: Need Help using LMCOPY in a Rexx program


External Message: Use Caution


Hello.Im not well versed in Rexx -I have cobbled some code together to 
copy/replace a member of a LIBRARY to ANother Library -.However I always grt a 
RC=10 from the LMCOPY the indsn is defined as a library with RECFM=80the outdsn 
is also defined as a library with RECFM=80Both use a different Blocksize -.To 
allocate the outdsn i coded the following:ADDRESS TSO
 IF SYSDSN("'"WORKDSN"'") = 'OK' THEN
 DO
 "ALLOC F("outdd") DA('"WORKDSN"') SHR REUSE"
 END
 ELSE
 DO
 "ALLOC F("outdd") DA("||"'"||WORKDSN||"'",
 ||") NEW SPACE (01,01) TRACK LRECL(080) RECFM(F) ",
 ||" DSNTYPE(LIBRARY) DIR(3)"
 ||" BLKSIZE(80)"
 END ..the indsn previously existed -.I can see both datasets in TSO 3.4.When I 
issue the LMCOPY statement, I Always get a RC=10Meaning: No data set is 
associated with the given data ID. -address ispexec
 "LMINIT DATAID("indd") DATASET("indsn") ENQ(SHR)"
 "LMINIT DATAID("outdd") DATASET("WORKDSN") ENQ(SHR)"
 "LMCOPY FROMID("indd") FROMMEM("REPLS2WS") TODATAID("outdd") ",
 "TOMEM("REPLS2WS") "REPLACE

lastcc = rc /* get retunr code from LMCOPY */
if lastcc = 0 then nop
 else
 say 'rc from LMCOPY='lastcc
 Say 'Copy Failed'
 "LMFREE DATAID("outdd")"
 exit..I suspect there is another Reason for RC 10 beacuse I can see in TSO 3.4 
both datasets ?.Any suggestions ?paul...

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN




----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to