IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Question on LMCOPY


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Thu Feb 12, 2015 5:41 pm
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: 1788
Location: Bloomington, IL

PostPosted: Thu Feb 12, 2015 6:22 pm
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: 206
Location: Globe, India

PostPosted: Thu Feb 12, 2015 6:44 pm
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: 206
Location: Globe, India

PostPosted: Thu Feb 12, 2015 6:45 pm
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: 1788
Location: Bloomington, IL

PostPosted: Thu Feb 12, 2015 7:13 pm
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: 206
Location: Globe, India

PostPosted: Thu Feb 12, 2015 7:30 pm
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

Global Moderator


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

PostPosted: Thu Feb 12, 2015 7:55 pm
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: 206
Location: Globe, India

PostPosted: Thu Feb 12, 2015 8:00 pm
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

Global Moderator


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

PostPosted: Thu Feb 12, 2015 8:13 pm
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: 1353
Location: Israel

PostPosted: Thu Feb 12, 2015 9:02 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Feb 12, 2015 9:24 pm
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: 206
Location: Globe, India

PostPosted: Fri Feb 13, 2015 12:50 pm
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

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Fri Feb 13, 2015 2:59 pm
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

Global Moderator


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

PostPosted: Fri Feb 13, 2015 7:44 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Question for file manager IBM Tools 7
No new posts question for Pedro TSO/ISPF 2
No new posts question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
No new posts panel creation question TSO/ISPF 12
No new posts Sort w/OUTREC Question DFSORT/ICETOOL 2
Search our Forums:

Back to Top