Page 1 of 1

Rexx to copy the members from one pds to another

PostPosted: Mon Mar 06, 2017 6:05 pm
by arya_starc
Hi All,
I write a rexx code which read the member from sequential dataset and read another PDS and if the readed member is present in the PDS. It copy the member in another PDS.
But the rexx code is working fine till it finds any duplicate member, that is If the member is already present in copy pds and it trying to copy again then my REXX code is terminated at that time and didd't run further.

Below is ny rexx code

 "ALLOC F(INFILE) DSN('VM.LAT.D10A.DETAILS.SE.ASM1')SHR REUSE"          
  "EXECIO * DISKR INFILE( FINIS STEM MYFILE."                            
  "FREE F(INFILE)"                                                        
  Address 'ISPEXEC'                                                      
  ARG INDD OUTDD NFLAG                                                    
  UPPER INDD OUTDD NFLAG                                                  
  OUTDD =""VM.LAT.D10A010.PF.PARMLIB.V1.ASM""                            
  INDD =""VM.LAT.D10A010.PC.PARMLIB""                                    
  ADDRESS 'TSO'"ALLOC DA("OUTDD")NEW LIKE("INDD")"                        
    DO I = 1 TO MYFILE.0                                                  
       MEMBER  = STRIP(SUBSTR(MYFILE.I,38,10))                            
      LOOKFOR = "'TS.PAFK.VM.LAT.D10A010.PC.PARMLIB("MEMBER")'"            
    X = SYSDSN(LOOKFOR)                                                  
    IF X = 'OK' THEN DO                                                  
     "LMINIT DATAID("DATA1")DATASET("INDD")ENQ(SHR)"                    
     "LMINIT DATAID("DATA2")DATASET("OUTDD")ENQ(SHR)"                    
     "LMCOPY FROMID("DATA1")FROMMEM("MEMBER")TODATAID("DATA2")"          
   END                                                                  
   ELSE                                                                  
   do                                                                    
      NOP                                                                
   END                                                                  
   END                                                                  
  EXIT                          
 


Note :I am trying using LMCOPY

Re: Rexx to copy the members from one pds to another

PostPosted: Mon Mar 06, 2017 7:00 pm
by Akatsukami
Don't use Rexx; instead, write a simple IEBCOPY job.

Re: Rexx to copy the members from one pds to another

PostPosted: Mon Mar 06, 2017 7:40 pm
by arya_starc
Job list is present in sequntial dataset , so first I need to read the dataset sequentailly to get the Job name.
That's why I am using rexx.

Re: Rexx to copy the members from one pds to another

PostPosted: Mon Mar 06, 2017 8:34 pm
by NicC
What did your trace show you? Why have you not included it (or the relevant part(s) of it)?

These 2 lines are rubbish:
OUTDD =""VM.LAT.D10A010.PF.PARMLIB.V1.ASM""                            
INDD =""VM.LAT.D10A010.PC.PARMLIB""

What are you trying to achieve with them?

What "job list"?

Re: Rexx to copy the members from one pds to another

PostPosted: Tue Mar 07, 2017 9:39 am
by arya_starc
job member name is readed by the sequntial datset will going to searched in input dataset INDD =""VM.LAT.D10A010.PC.PARMLIB"" and if it is found the member in that dataset. It will copy the member into output dataset VM.LAT.D10A010.PF.PARMLIB.V1.ASM.

Re: Rexx to copy the members from one pds to another

PostPosted: Tue Mar 07, 2017 12:47 pm
by Akatsukami
So "job list" is actually irrelevant; it doesn't matter what the members of the PDS contain :roll:

Re: Rexx to copy the members from one pds to another

PostPosted: Tue Mar 07, 2017 2:24 pm
by willy jensen
May I suggest that you read the manual, LMCOPY has a REPLACE option.

Re: Rexx to copy the members from one pds to another

PostPosted: Tue Mar 07, 2017 2:44 pm
by arya_starc
Akatsukami wrote:So "job list" is actually irrelevant; it doesn't matter what the members of the PDS contain :roll:

yes joblist is nothing just a sequential dataset which having data( data is member name).

Re: Rexx to copy the members from one pds to another

PostPosted: Tue Mar 07, 2017 3:22 pm
by NicC
Please study your post (and probaby code) carefully and also understand quoting of data set names: ""dataset.name"" is invalid, "dataset.name" or 'dataset.name' is valid. "'dataset.name'" and '"dataset,name"' are valid rexx quoting. If you have it quoted properly in your code then why is it not so in your post? You DID cut and paste, didn't you?

And where is your trace output?

I would also look at the list of related topics at the bottom of the page. The first looks as though it may be trying to do the same thing as you.