Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Question on LMCOPY

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Thu Feb 12, 2015 5:41 pm    Post subject: Reply to: LMMCOPY in Rexx
Reply with quote

I want to copy multiple PDS content into single output PDS. When I use LMCOPY in loop, it does not work for next iteration with same DATAID or DDNAME.

Any trick to crack this issue ?
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Feb 12, 2015 6:22 pm    Post subject:
Reply with quote

Yes; explain how it "doesn't work".
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Thu Feb 12, 2015 6:44 pm    Post subject:
Reply with quote

Code:
DO I =1 to 5
"LMINIT DATAID("INDD1") DATASET("PDSNAME") ENQ(SHRW)" <<--- i am populating new pdsname in every new iteration but my OUTPDS is always same, since i want to merge members from multiple PDS and replace if already exists
"LMINIT DATAID("OUTDD1") DATASET("OUTPDS") ENQ(SHRW)"               
"LMCOPY FROMID("INDD1") FROMMEM(*) TODATAID("OUTDD1") REPLACE TRUNC"
 "LMFREE DATAID("INDD1")"   
 "LMFREE DATAID("OUTDD1")" 
 "LMCLOSE DATAID("INDD1")" 
 "LMCLOSE DATAID("OUTDD1")"
end


But second iteration onwards my LMCOPY is failing. if i try using different DATAID i.e. INDD2 and OUTDD2 then it starts working.
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Thu Feb 12, 2015 6:45 pm    Post subject:
Reply with quote

I need help since i have 398 libraries from which i want to copy. icon_idea.gif
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Feb 12, 2015 7:13 pm    Post subject:
Reply with quote

Check the return codes from the LMINIT and LMCOPY services. I can already tell you that the LMCLOSE is useless, both because it comes after the LMFREE and because the data set was never opened.
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Thu Feb 12, 2015 7:30 pm    Post subject:
Reply with quote

perfect i have removved LMCLOSE.
If i see at LMINIT & LMCOPY Return codes, at first iteration it says 0 and at second iteration onwards LMINIT return code is 0 for both indd1 and outdd1 but LMCOPY is giving 10 means dataset is not associated with my DATAID. but i am unable to understand WHY ? Is there any limitation to use DATAID only for one copy iteration and start using different DATAIDs for further iterations e.g. INDD1 and OUTDD1 DATAIDs for first iteration, INDD2 and OUTDD2c DATAID for second iteration, INDD3 and OUTDD3 DATAID in third iteration and so on... but i am helpless since i cant use array as well and i have around 400 libraries from which members need to be copied.. icon_redface.gif
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Thu Feb 12, 2015 7:55 pm    Post subject: Reply to: Question on LMCOPY
Reply with quote

In the LMINIT, the DATAID(abc) parameter uses the name of the variable. In the LMCOPY and LMFREE, it is the value of the variable (rather than the name of the variable).

In your sample code segment, the LMINIT and LMFREE for the output file should be outside of the loop.
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Thu Feb 12, 2015 8:00 pm    Post subject:
Reply with quote

But i need to populate new PDSNAME in every iteration so that i would be able to copy members from that PDS.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Thu Feb 12, 2015 8:13 pm    Post subject: Reply to: Question on LMCOPY
Reply with quote

In the first iteration,
Code:
DATAID = 'DATAID'

as input to LMINIT. It uses 'DATAID' as the name of the variable to put the token in. After LMINIT,
Code:
DATAID = 'ISR0001'  /* for example*/

and it works because LMCOPY and LMFREE use ISR0001.

But on the second iteration,
Code:
DATAID = 'ISR0001'

as input to LMINIT. It uses 'ISR0001' as the name of the variable to put the token in. After LMINIT:
Code:
ISR0001 = 'ISR0002' /* for example*/
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Thu Feb 12, 2015 9:02 pm    Post subject:
Reply with quote

In other words, do:
Code:
"LMINIT DATAID(INDD1) DATASET("PDSNAME") ENQ(SHRW)"
(No quotes around INDD1, but only in the LMINIT)

In the sample you gave, you will copy the same file to the same place 5 times.
I hope your code is different.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Feb 12, 2015 9:24 pm    Post subject: Reply to: Question on LMCOPY
Reply with quote

Quote:
I want to copy multiple PDS content into single output PDS.

why waste time for a poor performing approach?
what is wrong in using the good old plain IEBCOPY in batch ???
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Fri Feb 13, 2015 12:50 pm    Post subject:
Reply with quote

Thanks a lot Marso and Pedro. It worked out.. Many Many Thanks.
Taken dump of 400 libraries in one go.... COOL icon_smile.gif

I would have prepared job as well with IEBCOPY through REXX, thanks for other option Enrico.

There is one doubt, if same members are present in multiple source libraries then it should get replaced with last source, so i used REPLACE option in LMCOPY with PACK option. But i see there is one more option as TRUNC.
Whats the difference between PACK and TRUNC ??
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Fri Feb 13, 2015 2:59 pm    Post subject:
Reply with quote

rohanthengal wrote:
Whats the difference between PACK and TRUNC ??

What's wrong with reading the manual, or giving the "MODEL" command and reading the generated NOTE lines it inserts?
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Fri Feb 13, 2015 7:44 pm    Post subject: Reply to: Question on LMCOPY
Reply with quote

Quote:
Taken dump of 400 libraries in one go

It is not totally clear what you are trying to accomplish... how about using ADRDSSU? or just issue HBACK command?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fault Analyzer - listings question. egrove IBM Tools 4 Thu Aug 11, 2016 5:31 pm
No new posts dataset copy question - REPRO or some... atulxp TSO/ISPF 2 Wed Aug 03, 2016 10:56 pm
No new posts SQL Order By related question Joseph K Thomas DB2 8 Fri Mar 18, 2016 12:53 pm
No new posts DFSort Question krrp DFSORT/ICETOOL 9 Mon Mar 07, 2016 7:11 pm
No new posts Question: REORG on LOB tablespaces rakesh1155 DB2 1 Fri Aug 14, 2015 2:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us