Rexx to copy the members from one pds to another



IBM's Command List programming language & Restructured Extended Executor

Rexx to copy the members from one pds to another

Postby arya_starc » Mon Mar 06, 2017 6:05 pm

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
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

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

Postby Akatsukami » Mon Mar 06, 2017 7:00 pm

Don't use Rexx; instead, write a simple IEBCOPY job.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

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

Postby arya_starc » Mon Mar 06, 2017 7:40 pm

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.
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

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

Postby NicC » Mon Mar 06, 2017 8:34 pm

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"?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

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

Postby arya_starc » Tue Mar 07, 2017 9:39 am

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.
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

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

Postby Akatsukami » Tue Mar 07, 2017 12:47 pm

So "job list" is actually irrelevant; it doesn't matter what the members of the PDS contain :roll:
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

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

Postby willy jensen » Tue Mar 07, 2017 2:24 pm

May I suggest that you read the manual, LMCOPY has a REPLACE option.
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

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

Postby arya_starc » Tue Mar 07, 2017 2:44 pm

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).
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

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

Postby NicC » Tue Mar 07, 2017 3:22 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post