/* rexx */ /*-------------------------------------------------------------------*/ /* */ /* REXX Exec : ASLTESTR */ /* */ /* Description : Tests for the existance of a dataset, if it */ /* exists it is emptied. If it doesn't it is created */ /* and then emptied. */ /* */ /* Created on : 03 Aug 2001 */ /* Created by : Kevin Ferguson */ /* : Userid MIT001 */ /* : Using ABBYDALE.DEVL.REXX(ASLTESTR) */ /* */ /* Called by : Many things */ /* */ /* Calls : LISTDSI */ /* */ /* Panels Used : None */ /* */ /* Change Activity : */ /* */ /* ©Copyright of Abbydale Systems LLC. */ /* */ /*-------------------------------------------------------------------*/ Parse upper arg Help rec dialogid = sysvar(sysicmd) parse source Exec_String excname = word(Exec_String,3) if Help = "" then do Say "No parmeter passed to" excname exit(8) end If Help = "?" Then do Call Disp_Help exit(4) end signal on halt /* attention key */ dsname = STRIP(Help) rec = STRIP(rec) TrapON=OutTrap('ON') "FREE ATTR(ASLA)" RECFM = If rec = '' then do rec = 133 recfm = A end "FREE ATTR(ASLA)" "ATTR ASLA LRECL("rec") RECFM(F B "recfm") BLKSIZE(0) DSORG(PS)" DsnStat=ListDsi("'"dsname"'" smsinfo) if DsnStat = 16 then do "ALLOC DA('"dsname"') NEW F(SYSUT2) REUS SPACE(600,100) USING(ASLA) UNIT(SYSALLDA)" end else do if sysdsorg <> "PS" then do say sysdsorg 'file types are not supported' exit(16) end "ALLOC DA('"dsname"') F(SYSUT2) SHR REUS" end line.1 = "" "EXECIO * diskw SYSUT2 (FINIS stem line." "FREE DD(SYSUT2)" "FREE ATTR(ASLA)" return /*-------------------------------------------------------------------*/ /* Disp_Help Procedure */ /*-------------------------------------------------------------------*/ Disp_Help: Procedure say "ASLTESTR - Tests for the existance of the passed dataset." say " If the dataset exists it is emptied, if it doesn't" say " exist it is created and then emptied" say"" say "Usage: ASLTESTR dsname lrecl | ?" say"" say" dsname - Is the name of the dataset to be emptied/created." say"" say" lrecl - (optional). Defines the record length for the" say" dataset being created. The default is 133" say"" say" ? - Generates this information." say"" say" Return Codes :" say" 4 - Help displayed" say" 8 - No parameter passed" say" 16 - Dataset not a sequential file" say"" Return /*-------------------------------------------------------------------*/ /* End of Disp_Help Procedure */ /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ /* Trap HALT Condition */ /*-------------------------------------------------------------------*/ halt: say "HALT acknowledged in line" sigl say "Cleanup processing in progress" address "TSO" "delstack" exit(16) /*-------------------------------------------------------------------*/ /* End of ASLTESTR */ /*-------------------------------------------------------------------*/