/* rexx */ /*-------------------------------------------------------------------*/ /* */ /* REXX Exec : ALIAS */ /* */ /* ***** Edit Macro ***** */ /* */ /* Description : Define an alias for the current member name. */ /* */ /* Created on : 15 Jul 2023 */ /* Created by : Wendy Miller */ /* : Userid MIT002 */ /* : Using ABBYDALE.PROD.EMACS(ALIAS) */ /* */ /* Called by : */ /* */ /* Calls : RENAME */ /* */ /* Panels Used : None */ /* */ /* Change Activity : */ /* */ /* ©Copyright of Abbydale Systems LLC. */ /* */ /*-------------------------------------------------------------------*/ Parse Arg Help /* Check for Help */ If SYSVAR("SYSISPF")<>"ACTIVE" then do Say "ISPF must be active to use "ALIAS exit(16) end Address ISREDIT "MACRO (Help) PROCESS" If Help = "?" Then do Call Disp_Help exit(4) end signal on halt /* attention key */ z = OUTTRAP('ON') Address ISREDIT "(MEM) = MEMBER" z = OUTTRAP('OFF') if rc = 20 then do ZEDSMSG = 'Invalid for dataset' ZEDLMSG = 'Alias is not allowed for the dataset' signal setmsg end signal on novalue /* un-initialized vars*/ if LENGTH(help) > 8 then do ZEDSMSG = 'Invalid alias name' ZEDLMSG = 'Alias name is too long' setmsg: Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" Address ISPEXEC "SETMSG MSG(ISRZ001)" exit(8) end forbid = '*%!&¬}{[_]:,;()' /* characters forbidden in member name */ forbid2 = '1234567890' /* Invalid first characters */ if POS(SUBSTR(help,1,1),forbid2) > 0 then do ZEDSMSG = 'Invalid alias name' ZEDLMSG = 'Invalid first character' SUBSTR(help,1,1) signal setmsg end x = 1 do until x = LENGTH(forbid) if POS(SUBSTR(forbid,x,1),help) > 0 then do k = POS(SUBSTR(forbid,x,1),help) ZEDSMSG = 'Invalid alias name' ZEDLMSG = 'Invalid character in ALIAS name' SUBSTR(help,k,1) signal setmsg end x = x + 1 end Address ISREDIT "(DSN) = DATASET" UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" LOWER = "abcdefghijklmnopqrstuvwxyz" help = TRANSLATE(help) z = OUTTRAP('list.') x = SYSDSN(''''DSN'('help')''') z = OUTTRAP("OFF") if x = 'OK' then do ZEDSMSG = 'Member name 'help' exists' ZEDLMSG = 'The member name 'help' already exists' signal setmsg end /* "ALLOC F(ALIAS) DA('"dsn"') SHR REUS" */ z = OUTTRAP('ON') "REN '"dsn"("mem")' ("help") ALIAS" /* "RENAME "dsn"("mem") "dsn"("help") ALIAS" */ z = OUTTRAP("OFF") if rc = 12 then do ZEDSMSG = 'dataset allocated elsewhere' ZEDLMSG = 'The dataset 'dsn' is allocated to another task' signal setmsg end ZEDSMSG = 'Alias created' ZEDLMSG = 'Alias 'help' successfully created' ZDLMSG = 'Alias successful' Address ISPEXEC "VPUT (ZDLMSG ZDLMSG) SHARED" Address ISPEXEC "SETMSG MSG(ISRZ001)" return /*-------------------------------------------------------------------*/ /* Disp_Help Procedure */ /*-------------------------------------------------------------------*/ Disp_Help: Procedure say "ALIAS - This edit macro will create an alias for the member " say " currently open for edit." say"" say "Usage: ALIAS xxxxx | ?" say"" say" ? - Generates this information." say"" say" Return Codes :" say" 0 - Alias created successfully" say" 4 - Help displayed" say" 8 - Invalid use of ALIAS" say" 16 - Not under ISPF" say"" Return /*-------------------------------------------------------------------*/ /* End of Disp_Help Procedure */ /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ /* Trap NOVALUE Condition */ /*-------------------------------------------------------------------*/ novalue: say "NOVALUE entered from line" sigl say condition("D") say "The instruction is suppressed" address "TSO" "delstack" exit(16) /*-------------------------------------------------------------------*/ /* Trap HALT Condition */ /*-------------------------------------------------------------------*/ halt: say "HALT acknowledged in line" sigl say "Cleanup processing in progress" address "TSO" "delstack" exit(16) /*-------------------------------------------------------------------*/ /* End of ALIAS */ /*-------------------------------------------------------------------*/