Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Copy members from Input PDS to Output PDS based on count

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 49
Location: India

PostPosted: Tue Jan 29, 2019 3:56 pm    Post subject: Copy members from Input PDS to Output PDS based on count
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

Senior Member


Joined: 14 Mar 2007
Posts: 10584
Location: italy

PostPosted: Tue Jan 29, 2019 4:08 pm    Post subject: Reply to: Copy members from Input PDS to Output PDS based on count
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 User


Joined: 01 Sep 2015
Posts: 270
Location: Denmark

PostPosted: Tue Jan 29, 2019 7:22 pm    Post subject:
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: 49
Location: India

PostPosted: Thu Jan 31, 2019 3:57 pm    Post subject:
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

Senior Member


Joined: 14 Mar 2007
Posts: 10584
Location: italy

PostPosted: Thu Jan 31, 2019 4:30 pm    Post subject: Reply to: Copy members from Input PDS to Output PDS based on count
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 User


Joined: 01 Sep 2015
Posts: 270
Location: Denmark

PostPosted: Thu Jan 31, 2019 6:11 pm    Post subject:
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: 49
Location: India

PostPosted: Fri Feb 01, 2019 10:27 am    Post subject:
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: 8777
Location: Welsh Wales

PostPosted: Fri Feb 01, 2019 1:15 pm    Post subject:
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 User


Joined: 01 Sep 2015
Posts: 270
Location: Denmark

PostPosted: Fri Feb 01, 2019 2:20 pm    Post subject:
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 User


Joined: 01 Sep 2015
Posts: 270
Location: Denmark

PostPosted: Fri Feb 01, 2019 2:35 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Search string from concatenated input... srini24 JCL & VSAM 8 Sat Mar 30, 2019 9:51 pm
No new posts Split input file into multiple files ... srini24 DFSORT/ICETOOL 1 Sat Mar 30, 2019 9:39 pm
No new posts count the number of records from diff... janmejay CA Products 4 Mon Mar 25, 2019 11:29 pm
No new posts How to copy\replace the members in pr... abdulrafi JCL & VSAM 6 Fri Mar 22, 2019 7:02 pm
No new posts SDSF limit access to specifc output c... David Beckham All Other Mainframe Topics 1 Thu Mar 21, 2019 10:29 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us