View previous topic :: View next topic |
Author |
Message |
karavi2000 Beginner
Joined: 17 Aug 2003 Posts: 51 Topics: 26 Location: Chennai
|
Posted: Mon Sep 01, 2003 1:06 am Post subject: How to split PDS into different PDS's depending on count? |
|
|
Hi,
I have a PDS having some 4000 members. I want to store those members in a different datasets on a sequence with each having 200 members. Is there any REXX Routine to just copy 1st 200 members in a sequnce into 1st dataset and next 200 in another dataset and so on? If you have 1, please let us know. It would be a great help for our team. |
|
Back to top |
|
 |
Manas Biswal Intermediate

Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
|
Posted: Tue Sep 02, 2003 12:52 pm Post subject: |
|
|
karavi2000,
It can be done if you use LM ISPF Facility in a REXX routine. Just use LMMLIST to scroll through the members of your source PDS (after using a LMINIT and LMOPEN on your source PDS) and after each invocation of LMMLIST, use LMCOPY to copy the member of the source dataset to the target PDS. Use a counter to tell you when you have copied 200 members after which you can change your target dataset to the next PDS. You can store all your target dataset names in a stem variable and after each 200 copies, change the target dataset name by incrementing the stem variable by 1. This way you can do the whole process in a loop.
I will write a sample code as soon as I get the time. Meanwhile you can try the above.
Regards,
Manas |
|
Back to top |
|
 |
Manas Biswal Intermediate

Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
|
Posted: Wed Sep 03, 2003 3:53 pm Post subject: |
|
|
Here is the code. This REXX routine splits a PDS having 10 members into 2 PDS each having 5 members. You can use this to solve your problem. Just change the PDS names to your own and the counters to reflect the number of members you want to copy. Everything is done in a loop and so you should not have any problems in extrapolating this sample REXX to your case.
Code: |
/**** rexx *****/
/**********************************************************************/
/**** This is REXX program which copies members of a PDS into more */
/**** than one target PDS */
/**********************************************************************/
trace O
pdsi = 'u457527.manas.input'
drop pdso.
pdso. = ''
pdso.1 = 'u457527.manas.output1'
pdso.2 = 'u457527.manas.output2'
ADDRESS ISPEXEC "LMINIT DATAID(INP) DATASET('"pdsi"') ENQ(SHR)"
ADDRESS ISPEXEC "LMOPEN DATAID(&INP)"
do count = 1 to 2 by 1
ADDRESS ISPEXEC "LMINIT DATAID(OP1) DATASET('"pdso.count"') ENQ(SHR)"
/** ADDRESS ISPEXEC "LMOPEN DATAID(&OP1)" **/
mnvar = ' '
do counter = 1 to 5 by 1
ADDRESS ISPEXEC "LMMLIST DATAID("INP") OPTION(LIST) MEMBER(MNVAR)"
ADDRESS ISPEXEC "LMCOPY FROMID(&INP) FROMMEM("MNVAR") TODATAID(&OP1)"
end
ADDRESS ispexec "LMCLOSE DATAID(&OP1)"
ADDRESS ISPEXEC "LMFREE DATAID(&OP1)"
end
ADDRESS ISPEXEC "LMCLOSE DATAID("INP")"
ADDRESS ISPEXEC "LMFREE DATAID("INP")"
say 'Copy of members complete..'
say 'Exitting out of the application..'
exit
|
Get back to me in case you face any problems.
Regards,
Manas |
|
Back to top |
|
 |
|
|