/* rexx */ /*-------------------------------------------------------------------*/ /* */ /* REXX Exec : USERNAME */ /* */ /* Description : Returns the logged on user name to the caller */ /* */ /* Created on : 20 May 2021 */ /* Created by : Kevin Ferguson */ /* : Userid(MIT001) */ /* : using ABBYDALE.DEVL.REXX(USERNAME) */ /* */ /* Called by : REXXIT */ /* */ /* Calls : Nothing but it does PUSH a variable onto a stack */ /* */ /* Panels Used : None */ /* */ /* Change Activity : */ /* */ /* MM/DD/YYYY ID Comment */ /* --------------------------------------------------------------- */ /* 06/13/2021 CMD Allow exec to be called as a normal exec */ /* */ /* ©Copyright of Abbydale Systems LLC. */ /* */ /*-------------------------------------------------------------------*/ Parse Arg Help /* Check for Help */ If Help = "?" Then do Call Disp_Help exit(4) end If arg = "?" Then do /*CMD*/ Call Disp_Help /*CMD*/ exit(4) /*CMD*/ end /*CMD*/ /*gnal on novalue un-initialized vars CMD*/ signal on halt /* attention key */ Orig = ARG(1) /* Get where to put it */ ascb = storage(224,4) /* psaaold */ asxb = storage(d2x(c2d(ascb)+108),4) /* ascbasxb */ acee = storage(d2x(c2d(asxb)+200),4) /* acee */ unam = storage(d2x(c2d(acee)+100),4) /* aceeunam */ name=strip(storage(d2x(c2d(unam)+1),24)) /* Get name */ parse upper var name /* fold to uppercase to make the check easier */ y = 1 /* Start character */ do until y >= 24 x = substr(name,y,1) if x <> ' ' then do if x < "A" then do k = y-1 y = 24 end if x > "Z" then do k = y-1 y = 24 end end y = y + 1 end name = substr(name,1,k) y = words(name) x = 1 xname = "" if y >= 1 then do do until x > y xname = xname||Proper(word(name,x))||" " x = x + 1 end end else do xname = "Not Specified" end xname = '"'||strip(xname)||'"' if orig = "" then do /*CMD*/ say xname /*CMD*/ end /*CMD*/ else do /*CMD*/ push xname end /*CMD*/ return /*-------------------------------------------------------------------*/ /* Disp_Help Procedure */ /*-------------------------------------------------------------------*/ Disp_Help: Procedure say "USERNAME - Returns the name of the current signed on user that is" say " runnng the EXEC. If no name is associated with the" say " TSO userid 'Not Specified' is returned" say"" say "Usage: USERNAME | ?" say"" say" No parameter is actually required as the EXEC can only extract" say" the name from the control blocks of the user running the EXEC." say" " say" ? - Generates this information." say"" say" Return Codes :" say"" say" 4 - Help displayed" 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 USERNAME */ /*-------------------------------------------------------------------*/