Under z/OS, I want to write a REXX or CLIST script to copy one sequential data set to another and then run another script (REXX). The other script expects a specific SDS to exist and I want to be able to copy one of many options to that member before running the second script. This is from TSO so I don't have access to any of the fancy ISPF stuff.
So, basically:
Copy 'level1.level2.name.type1' to 'level1.level2.name'
runother p1 p2 p3
The runother
Rexx script uses 'level1.level2.name' to do its own magic - I'm just providing a different one for each of my possibilities.
So I need a script called 'xx42' which copies 'level1.level2.name.42' and I can then modify that for values other than 42. Even better would be to parameterize that script so I could just use
xx 42 p1 p2 p3
or
xx 27 p1 p2 p3
rather than having a script for each value. This would copy the given SDS then pass parameters p1
, p2
and p3
through to runother
.
While searching for something else, I came across this post. (i.e. it did not take me 2 years to formulate this response) and thought future mainframians (do we still exist?) might find it useful.
You could also do a SMCOPY:
address TSO "SMCOPY FDS('LEVEL1.LEVEL2.NAME.42') TDS('LEVEL2.LEVEL2.NAME')"
FDS - from dataset, TDS - to dataset. If TDS doesn't exist, you will get a return code 4, but the copy will have been executed. You can use SMCOPY to copy library members as well.