Show the code, not just snippets. -- 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 5:59 PM To: [email protected] <[email protected]> Subject: Re: Need Help using LMCOPY in a Rexx program External Message: Use Caution Following some of the suggestions posted -I added a TRACE to the initial Rexx source, and found out that LMINIT Failed with RC=8. Then I reviewed the suggestion provided by Lionel B. Dyck and Willy Jensens, and created a separate stand alone exec to run.In CASE II set two variables : in_dsn_var = 'TEST.LPAR1.JCL' out_dsn_var = 'TEST.LPAR1.WORK' Say 'out_dsn_var ......... ' out_dsn_var..In CASE III set the following -HUSER = USERID() string1 = HUSER string2 = '.LPAR1.WORK' in_dsn_var = 'TEST.LPAR1.JCL' out_dsn_var = string1||string2 Say 'out_dsn_var ......... ' out_dsn_var.CASE Iit performed as expected and restore the member in the target PDSTHe EXEC Ended with RC=00.CASE IIFailed with RC=10 - I dont quite understand why .. out_dsn_var = string1||string2 .. causes LMCOPY to Fail with lmcopy rc: 10 .the string is need as the output dataset needs a TSO Userid as its High Level Qualifier .... paul ---------- Original Message ---------- From: Willy Jensen <[email protected]> To: [email protected] Subject: Re: Need Help using LMCOPY in a Rexx program Date: Tue, 16 Dec 2025 14:13:13 -0600 My preference in cases like this is to use BPXWDYN instead of ALLOC, that way you can do something like this (slight variation of Lionel's sample) which makes BPXWDYN generate the ddnames: cc=BpxWdyn('alloc da('in_dsn_var') shr rtddn(indd)') if cc<>0 then exit xmsg('alloc' in_dsn_var rc' cc)+16 cc=BpxWdyn('alloc da('out_dsn_var') shr rtddn(outdd)') if cc<>0 then exit xmsg('alloc' out_dsn_var rc' cc)+16 Address ISPexec "lminit dataid(indid) ddname("indd")" "lminit dataid(outdid) ddname("outdd")" "lmcopy fromid("indid") todataid("outdid") frommem(a*) replace" say 'lmcopy rc:' rc "lmfree dataid("indid")" "lmfree dataid("outdid")" cc=BpxWdyn('free dd('indd')') cc=BpxWdyn('free dd('outdd')') exit 0 xmsg: say arg(1); return 0 Note, done from the top of my head, but hopefully all quotes etc are ok. ---------------------------------------------------------------------- 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
