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
.
After a bit of fiddling around, I figured out you can manually allocate the required data sets and run IEBGENER
to do the copy:
/* REXX */
"ALLOC FI(SYSPRINT) DUMMY REUSE"
"ALLOC FI(SYSIN) DUMMY REUSE"
"ALLOC FI(SYSUT1) DA('LEVEL1.LEVEL2.NAME.42') SHR REUSE"
"ALLOC FI(SYSUT2) DA('LEVEL1.LEVEL2.NAME') SHR REUSE"
"IEBGENER"
RC2 = RC
"FREE FI(SYSUT1)"
"FREE FI(SYSUT2)"
"FREE FI(SYSPRINT)"
"FREE FI(SYSIN)"
IF RC2 ^= 0 THEN DO
SAY "IEBGENER FAILED."
END
ELSE DO
RUNOTHER P1 P2 P3
END