The syntax for LMINIT is LMINIT DATAID(data-id-var) etc. Data-id-var is the 
*name* of the variable that will store the data id.

The syntax for subsequent commands, such as LMCOPY, is that you pass the 
*value* of the data id: it was the value that LMINIT put in the variable.

For example:

  - LMINIT DATAID(FROMID)       /* ISPF puts something like I12309 in variable 
FROMID) */
  - LMCOPY FROMID(&FROMID)      /* pass the value of FROMID back */

DATAIDs are not DD names, although you can create a DATAID from a DD via LMINIT 
DATAID(data-id-var) DDNAME(ddname).

In your code, I can't tell if you're ever assigning values to INDD or OUTDD. If 
you do, then that would explain the problem.

For example, let's say that INDD was assigned D12302. Then:

"LMINIT DATAID("indd")"  means LMINIT DATAID(D12302)  means assign the data id 
to variable D12302

"LMCOPY FROMID("indd")" means LMCOPY FROMID(D12302), but there is no data id 
D12302. Hence, RC=10


-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
[email protected]
Sent: Tuesday, December 16, 2025 11:39 AM
To: [email protected]
Subject: Need Help using LMCOPY in a Rexx program

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

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

Reply via email to