View previous topic :: View next topic
|
Author |
Message |
Poha Eater
New User
Joined: 31 Aug 2016 Posts: 74 Location: India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
based on the count provided. |
the count of what ??? |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
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 |
|
|
Poha Eater
New User
Joined: 31 Aug 2016 Posts: 74 Location: India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
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 |
|
|
Poha Eater
New User
Joined: 31 Aug 2016 Posts: 74 Location: India
|
|
|
|
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 |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I would love to know the reason behind such a wierd request
What do you hope to achieve doing this |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
JCL by itself doesn't do anything. It is used for allocating resources (datasets) and start programs. |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
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 |
|
|
|