/* rexx */ /*-------------------------------------------------------------------*/ /* */ /* REXX Exec : ONEEXT */ /* */ /* Description : Make a dataset into just one extent. */ /* */ /* Created on : 27 Feb 2021 */ /* Created by : Kevin Ferguson */ /* : Userid MIT001 */ /* : using ABBYDALE.PROD.REXX(ONEEXT) */ /* */ /* Called by : */ /* */ /* Calls : LISTDSI */ /* */ /* Change Activity : */ /* */ /* ©Copyright of Abbydale Systems LLC. */ /* */ /*-------------------------------------------------------------------*/ parse upper arg dsname keep if dsname = "?" then do call disp_help exit(4) end dsname = strip(dsname,b,"'") kf = outtrap('on') DSN_STATUS = LISTDSI(''''dsname'''' smsinfo) kf = outtrap('off') if sysextents = 0 then exit if sysextents = 1 then do ZEDSMSG = 'ONEEXT Not run' ZEDLMSG = dsname 'already in 1 extent' ZDLMSG = 'ONEEXT not run' ZDLREF = 'Y' Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" address ISPEXEC "SETMSG MSG(ISRZ001)" exit end if LENGTH(dsname) < 42 then do newdsname = dsname||".O" end else do ZEDSMSG = 'ONEEXT Failed' ZEDLMSG = dsn 'too long to process' ZDLMSG = "ONEEXT Failed" ZDLREF = 'Y' Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" address ISPEXEC "SETMSG MSG(ISRZ001)" exit end secs = 0 if keep <> "" then do secs = sysseconds end if sysunits = "BLOCK" then do quantity = sysalloc /* sysblkstrk */ Allocin = sysunits"("sysblksize") SPACE("quantity","secs")" end else do Allocin = sysunits "SPACE("sysused","secs")" end if sysstorclass = '' then do "ALLOC F(DATAOUT) DATASET('"newdsname"') NEW CATALOG , VOL("sysvolume") UNIT(SYSALLDA) LIKE('"dsname"') REUS", allocin end else do "ALLOC F(DATAOUT) DATASET('"newdsname"') NEW CATALOG , LIKE('"dsname"') REUS , STORCLAS("sysstorclass") "allocin end if rc > 0 then do ZEDSMSG = 'ONEEXT Failed' ZEDLMSG = 'Allocation failed for 'newdsname ZDLMSG = "ONEEXT Failed" ZDLREF = 'Y' Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" address ISPEXEC "SETMSG MSG(ISRZ001)" exit 16 end SELECT WHEN sysdsorg = 'PS' then do "Alloc F(DATAIN) da('"dsname"') 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('"dsname"') 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 ZEDSMSG = 'ONEEXT Failed' ZEDLMSG = sysdsorg 'files are not supported' ZDLMSG = "ONEEXT Failed" ZDLREF = 'Y' Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" address ISPEXEC "SETMSG MSG(ISRZ001)" outit = outtrap('on') "delete '"newname"'" outit = outtrap('off') exit 16 exit end end if rc > 0 then do ZEDSMSG = 'ONEEXT Aborted' ZEDLMSG = 'Copy step failed. Run Aborted' ZDLMSG = 'ONEEXT Aborted' ZDLREF = 'Y' Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" address ISPEXEC "SETMSG MSG(ISRZ001)" outit = outtrap('on') "delete '"newname"'" outit = outtrap('off') exit 16 end "del '"dsname"'" "alter '"newdsname"' NEWNAME('"dsname"')" ZEDSMSG = 'ONEEXT Ended' ZEDLMSG = dnsame 'no in a single extent' ZDLMSG = 'ONEEXT Ended' ZDLREF = 'Y' Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" address ISPEXEC "SETMSG MSG(ISRZ001)" exit /*-------------------------------------------------------------------*/ /* disp_help procedure */ /*-------------------------------------------------------------------*/ disp_help: procedure say "ONEEXT - a REXX exec to rebuild a dataset into one extent." say "" say "Usage: ONEEXT dsname keep | ? " say "" say " dsname - Specified the name of the module to locate." say " keep - (optional). If anything is passed as a second" say " parameter then the current secondary allocation" say " value is used for the recreated dataset. If this" say " value is omitted then a 0 secondary allocation will" say " be used." say " ? - generates this information." say "" say " Return Codes : 0 - Dataset recreated" say " 4 - Help displayed" say " 8 - Module not found" Say " 16 - Critical error" return /*-------------------------------------------------------------------*/ /* End of ONEEXT */ /*-------------------------------------------------------------------*/