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

LMMcopy to copy all members in a pds to another in rexx


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

New User


Joined: 10 Feb 2009
Posts: 26
Location: chennai

PostPosted: Fri Mar 20, 2009 11:11 pm
Reply with quote

Hi am using LMMcopy to copy all members in a pds to another in rexx
ex:
I want to copy these prod pds
CHGMAN.XXX.AAA.SRA
CHGMAN.XXX.AAA.PR1
CHGMAN.XXX.AAA.JC1
(I identify these pds using LISTDS command )
to
USERID.XXX.AAA.SRA
USERID.XXX.AAA.PR1
USERID.XXX.AAA.JC1

But i face issue here
it copies *.PR1 and *.JC1 but not *.SRA s
it gives a return code of 8 for SRA alone.. though there are members in it
If i write a code to copy SRA alone then it does a neat copy

Any idea why this occurs

Or shud i use IEBCOPY if so HOW??

any example how to code IEBCOPY for my case
The PDS name is manipulated and should be given as input

regards
raki
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Sat Mar 21, 2009 1:15 am
Reply with quote

Can you post your code?
Back to top
View user's profile Send private message
raki_new

New User


Joined: 10 Feb 2009
Posts: 26
Location: chennai

PostPosted: Sat Mar 21, 2009 4:30 pm
Reply with quote

Code:
X = OUTTRAP('DSNLIST.')                     
 ADDRESS TSO "LISTDS '"DSN_NAME"' LEVEL"     
 DO I = 1 TO DSNLIST.0 BY 5                   
  SAY DSNLIST.I                               
  S=USERID()                                 
PDS1 =DSNLIST.I                               
SAY PDS1                                     
PARSE VAR PDS1 M1 '.' M2 '.' M3 '.' M4 '.' M5
SAY M5                                       
TRAIL =LEFT(M5,'3')                                         
SAY TRAIL                                                   
IF SYSDSN(""PDS1"") = OK THEN DO                             
PDS2=S||."USER."||T2||".#"||T3||"."||TRAIL                   
SAY PDS2                                                     
ADDRESS TSO "ALLOC DD(OUTDD1) DS('"PDS2"') NEW ,             
RECFM(F)  DIR(100) LRECL(132) SPACE(100,100) CYLINDERS "     
"LMINIT DATAID(INDD1) DATASET('&PDS1')"                     
SAY RC                                                       
"LMINIT DATAID(OUTDD1) DATASET('&PDS2')"                     
SAY RC                                                       
"LMOPEN DATAID("INDD1")"                                     
                                     
DO FOREVER = 1                                               
TRACE I                                                     
   "LMMLIST DATAID("INDD1") MEMBER(LMMEM)"                   
   SAY LMMEM                                                 
    SAY RC                                                         
  IF RC > 0 THEN LEAVE                                             
      "LMCOPY FROMID("INDD1") TODATAID("OUTDD1") FROMMEM(&LMMEM)   
       TOMEM(&LMMEM)REPLACE PACK"                                 
       SAY RC                                                     
       IF RC?=0 THEN                                               
       SAY 'FAILED TO COPY'                                       
 END                                                               
 "LMCLOSE DATAID("INDD1")"                                         
 "LMFREE DATAID("INDD1")"                                         
 "LMFREE DATAID("OUTDD1")"                                         
 ADDRESS TSO 'FREE DD(OUTDD1)'                                     
 LMMEM =NULL                                                       
 END                                                               
 END                                                           
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Mar 21, 2009 4:46 pm
Reply with quote

look like You posted a mangled version of Your script

You parse with m1 m2 m3 m4 m5, and then You use t2 t3

but..
Quote:
I want to copy these prod pds
CHGMAN.XXX.AAA.SRA
CHGMAN.XXX.AAA.PR1
CHGMAN.XXX.AAA.JC1
(I identify these pds using LISTDS command )
to
USERID.XXX.AAA.SRA
USERID.XXX.AAA.PR1
USERID.XXX.AAA.JC1

for a simple copy like this one I would investigate a DFDSS copy with a rename
Back to top
View user's profile Send private message
raki_new

New User


Joined: 10 Feb 2009
Posts: 26
Location: chennai

PostPosted: Sat Mar 21, 2009 5:13 pm
Reply with quote

I parsed just to get M5 value alone..

T2 and T3 are other variable initalized before which was not pasted alone with the code.

Can u give me more idea about DFDSS copywith a rename
...

Note : we are creating output pds inside the loop ...
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Mar 21, 2009 5:35 pm
Reply with quote

something on the style

Code:
//COPY     EXEC PGM=ADRDSSU
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
 COPY DATASET(INCLUDE(CHGMAN.XXX.AAA.*)) -
      REPLACEUNCONDITIONAL -
      RENAMEU(USERID)
/*


here is the link to the manual pages for the dfdss copy command
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DGT2S261/2.3.6?SHELF=DGT2BK71&DT=20080128160125
Back to top
View user's profile Send private message
raki_new

New User


Joined: 10 Feb 2009
Posts: 26
Location: chennai

PostPosted: Sat Mar 21, 2009 5:44 pm
Reply with quote

The input and output PDS name are manipulated here..
Can we do this in the code which u have given.
and how to include this code in rexx ??
Please help..
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Mar 21, 2009 5:55 pm
Reply with quote

why do You change Your mind as the topic proceeds ?

My solution fits perfectly the initial post

learn to post the exact details from the beginning
You make people lose time on devising and testing ( Yes, I said test ) useless solutions
for sloppy requiremens
Back to top
View user's profile Send private message
raki_new

New User


Joined: 10 Feb 2009
Posts: 26
Location: chennai

PostPosted: Sat Mar 21, 2009 6:06 pm
Reply with quote

As u see in code

using LISTDS i identify the PDS names (which is in a loop)
here we dont know what will be exact PDS
(what i gave was a example)

then i manipulated to create a output pds based on the input's name
and i copy the pds members

so in the second instance of the loop i ll get another pds name
which has to be given as input.. .
can this be done...

sorry for the inconvience

regards
Back to top
View user's profile Send private message
raki_new

New User


Joined: 10 Feb 2009
Posts: 26
Location: chennai

PostPosted: Mon Mar 23, 2009 12:07 pm
Reply with quote

Any replies for my question ??
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Mon Mar 23, 2009 12:36 pm
Reply with quote

I think I'm not the only one that didn't understand your question, that's why you didn't get any answers.

O.
Back to top
View user's profile Send private message
raki_new

New User


Joined: 10 Feb 2009
Posts: 26
Location: chennai

PostPosted: Mon Mar 23, 2009 12:48 pm
Reply with quote

Let me make it more clear.

I first identify the no of PDS available which starts with
CHGMAN.XXX.AAA.* (search)using LISTDS.
Then each PDS listed needs to copied.

if members are available inside the PDS
then each members needs to be copied to the corresponding PDS which is
newly created.

CHGMAN.XXX.AAA.SRA
CHGMAN.XXX.AAA.PR1
CHGMAN.XXX.AAA.JC1
to
USERID.XXX.AAA.SRA
USERID.XXX.AAA.PR1
USERID.XXX.AAA.JC1

Any idea how to do this..
I tried with LMMCOPY .. The code is in the thread..
but am not able to copy all datasets ..
please help me to acheive this .
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Mar 23, 2009 12:55 pm
Reply with quote

So You went back to the original requirement...

use the jcl I gave You as a sample !
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Mon Mar 23, 2009 12:57 pm
Reply with quote

You can also use IEBCOPY.

O.
Back to top
View user's profile Send private message
raki_new

New User


Joined: 10 Feb 2009
Posts: 26
Location: chennai

PostPosted: Mon Mar 23, 2009 2:07 pm
Reply with quote

thanks .. Its working ..icon_smile.gif
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top