/* rexx */ /*-------------------------------------------------------------------*/ /* */ /* REXX Exec : CLONE */ /* */ /* Description : Create a copy of a dataset. Invoke by typing */ /* CLONE next to the dataset name on the ISPF 3.4 menu*/ /* */ /* Created on : 31 Mar 2018 */ /* Created by : KEVIN FERGUSON */ /* : Userid(MIT001) */ /* : using ABBYDALE.XFER.REXX(CLONE) */ /* */ /* Called by : */ /* */ /* Calls : REPRO, IEBCOPY, LISTDSI */ /* */ /* Change Activity : */ /* */ /* MM/DD/YYYY ID Comment */ /* --------------------------------------------------------------- */ /* 08/15/2022 NEW Changed to allow quotes around the new name */ /* 10/20/2023 FIX Fixed the issue when no answer is given for */ /* new volume definition. */ /* */ /* ©Copyright of Abbydale Systems LLC. */ /* */ /*-------------------------------------------------------------------*/ parse upper arg dsn vol dsn = strip(dsn,b,"'") s = userid() new = dsn do while new = dsn say 'Enter new name' pull new iterate end new = strip(new,b,"'") /*NEW*/ trace o DSN_STATUS = LISTDSI(''''dsn'''' smsinfo) volume = sysvolume done = 'N' do until done = 'Y' say 'Allocate to a new volume? (Y or N)' pull ans SELECT when ans = 'Y' then do say 'Enter target volume' pull volume if LENGTH(volume) = '6' then do done = 'Y' end end when ans = 'N' then do done = 'Y' otherwise nop /*FIX*/ end end say new 'will be allocated on' volume TrapON=OutTrap('ON') "ALLOC F(DATAOUT) DATASET('"new"')" , "SHR VOL("volume") UNIT("sysunit") REUS" trace 0 if kf = 0 then do say new "already exists on" vol ". Do you want to overwrite it?" pull ans if ans <> "Y" then exit end else do If sysstorclass = '' then do "ALLOC F(DATAOUT) DATASET('"new"') NEW CATALOG VOL("volume")" , "UNIT(3390) LIKE('"dsn"') REUS" end else do say dsn ' is SMS Managed' TrapON=OutTrap('OFF') "ALLOC F(DATAOUT) DATASET('"new"') NEW CATALOG" , " LIKE('"dsn"') REUS", " STORCLAS("sysstorclass")" /* " MGMTCLAS("sysmgmtclass")" , " DATACLAS("sysdataclass")" */ end end /* if empty <> '' then exit */ DSN_STATUS = LISTDSI(''''dsn'''' DIRECTORY) SELECT WHEN sysdsorg = 'PS' then do "Alloc F(DATAIN) da('"dsn"') SHR REUS" "repro infile(DATAIN) outfile(DATAOUT)" kef = rc 'FREE F (DATAIN DATAOUT)' say "Copy ended Return code" kef end WHEN sysdsorg = 'PO' then do TrapON=OutTrap('Off') "Alloc F(DATAIN) da('"dsn"') vol("sysvolume") SHR REUS" "Alloc F(DATAOUT) da('"new"') vol("volume") SHR REUS" "FREE FI(SYSIN,SYSPRINT,SYSUT3,SYSUT4)" "ALLOC FILE(SYSIN) SPACE(1,1) TRACK LRECL(80) RECFM(F) BLKSIZE(80) REU" "ALLOC FILE(SYSPRINT) da(*) BLKSIZE(121)" "ALLOC FILE(SYSUT3) UNIT(SYSDA) SPACE(1,1) CYLINDERS REU" "ALLOC FILE(SYSUT4) UNIT(SYSDA) SPACE(1,1) CYLINDERS REU" SYSIN.1 = " COPY OUTDD=DATAOUT,INDD=((DATAIN,R))" 'EXECIO * DISKW SYSIN (STEM SYSIN. FINIS' "CALL 'SYS1.LINKLIB(IEBCOPY)' 'SIZE=512K'" kef = rc say "Copy ended Return code" kef end otherwise do say sysdsorg " Files are not supported" exit end end /* "free f(DATAIN DATAOUT)" */ exit /*-------------------------------------------------------------------*/ /* End of CLONE */ /*-------------------------------------------------------------------*/