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

Copy members from Input PDS to Output PDS based on count


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 74
Location: India

PostPosted: Tue Jan 29, 2019 3:56 pm
Reply with quote

Hi,

I wanted to ask if it is possible to copy members from one PDS to another PDS based on the count provided. I searched on the internet but did not anything concrete regarding my query.

Please let me know if anyone has the way to solve it.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Jan 29, 2019 4:08 pm
Reply with quote

Quote:
based on the count provided.

the count of what ???
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Tue Jan 29, 2019 7:22 pm
Reply with quote

The PDS86 program from CBTTAPE.ORG file 182 has an IF statement where you can select members on ABOVE or BELOW count. The generated selection list can then be used in a subequent COPY operation.
ISPF LMMDISP function can provide member info which can be checked and provide a basis for LMMCOPY, assuming that statistics are available.
But I too would like to know which count you are looking for and what would be the purpose of such a selection?
Back to top
View user's profile Send private message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 74
Location: India

PostPosted: Thu Jan 31, 2019 3:57 pm
Reply with quote

Quote:
the count of what ???


Suppose i have thousands of members in a PDS and i want to copy first 100 members of the PDS to one PDS then next 100 to another PDS and so on till the last member and if in the last only 50 or 60 members remains then it should be copied to the last pds.

Here what i am asking is that is it possible to create PDS dynamically based on the count provided by user (like 100 which i gave in above example).

And if it not possible then i can create PDS manually but is there a way where i can copy members from Input PDS to Output PDS based on the number i provide in the jcl ?

Please let me know your thoughts.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Jan 31, 2019 4:30 pm
Reply with quote

looks like a PHB requirement

do You/Your PHB realise that it will be a nightmare to keep track what went where ???

but it can be done with a properly written rexx script
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Thu Jan 31, 2019 6:11 pm
Reply with quote

Ok, I'll bite, yes it is doable. The following REXX sample will split the input lib by interval, creating a new lib. The outds variable is a dataset prefix to which will be added '.Nnumber'. The sample was quickly knocked together, so better solutions are surely possible. The performance is pretty horrible, so if this is something that must be done regularly, I would look for another way. My personal preference would to use an ISPF skeleton to dynamically generate a batch job.
Run by: rexxname inlibname outprefix
Code:
 arg inds outds /* datasets, outds is dataset prefix !! */   
 parse value '' with idid odid                               
 intvl=100                                                   

 zz=outtrap('lst.')                                         
 "listds '"inds"' members"                                   
 cc=rc                                                       
 zz=outtrap('off')                                           
 if cc<>0 then exit Close('Listds' inds 'rc' cc,8)           
 say time() lst.0 -6 'members in' inds                       
                                                             
 address ispexec                                             
 "lminit dataid(idid) dataset('"inds"') enq(shr)"           
 if rc<>0 then exit Close('Lminit inds' inds 'rc' rc,8)     
                                                             
 /* create and copy */                                       
 dn=0                                                       
 do lstn=7 to lst.0                                         
   mbrn=lstn-6                                               
   if mbrn=1 | (mbrn-1)//intvl=0 then do /* interval */     
     if dn>0 then "lmfree dataid("odid")"                   
     dn=dn+1                                                 
     da=outds'.N'dn                                         
     cc=Bpxwdyn('alloc da('da') new catalog like('inds')')   
     if cc<>0 then exit Close('Alloc new ds' da 'rc' cc,8)   
     "lminit dataid(odid) dataset('"da"') enq(shr)"         
     if rc<>0 then exit Close('Lminit new ds' da 'rc' rc,8) 
     say time() 'new ds' da 'created'                       
   end                                                       
   mbr= strip(lst.lstn)                                     
   "lmcopy fromid("idid") todataid("odid")",                 
     "frommem("mbr") replace"                               
   if rc<>0 then exit Close('Lmcopy' mbr 'to' da 'rc' rc,8) 
 end                                                         
 exit Close('All ok')                                       
                                                             
Close:                                                       
 if arg(1)<>'' then say arg(1)                               
 if idid<>'' then address ispexec "lmfree dataid("idid")"   
 if odid<>'' then address ispexec "lmfree dataid("odid")"   
 exit word(arg(2) 0,1)                                       
Back to top
View user's profile Send private message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 74
Location: India

PostPosted: Fri Feb 01, 2019 10:27 am
Reply with quote

Thanks for the time you take to reply Enrico & Willy. Appreciate the assistance. I was hoping to achieve it through JCL but you guys suggesting that it can be doable by REXX so i am guessing it is not doable by JCL. Also i am a beginner in REXX and very basic understanding in REXX so far but i will try to achieve this by using sample provided by Willy, really appreciate this. I will come back to you guys if i face any further roadblock.

Again really thanks for your time and showing me the right path icon_biggrin.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Feb 01, 2019 1:15 pm
Reply with quote

I would love to know the reason behind such a wierd request

What do you hope to achieve doing this
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Fri Feb 01, 2019 2:20 pm
Reply with quote

JCL by itself doesn't do anything. It is used for allocating resources (datasets) and start programs.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Fri Feb 01, 2019 2:35 pm
Reply with quote

Is this a one-off? If so it might be faster doing it by hand:
- allocate the target libraries using ISPF 3.2
- copy members using ISPF 3.3 block member selection
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts VB to VB copy - Full length reached SYNCSORT 8
Search our Forums:

Back to Top