/* rexx */ /*-------------------------------------------------------------------*/ /* */ /* REXX Exec : GETDSN */ /* */ /* Description : Get the dataset associated with a DD card */ /* */ /* Created on : 16 Apr 2022 */ /* Created by : Wendy Miller */ /* : Userid MIT002 */ /* : Using ABBYDALE.DEVL.REXX(GETDSN) */ /* */ /* Called by : PRODVERS */ /* */ /* Calls : */ /* */ /* Panels Used : */ /* */ /* Change Activity : */ /* */ /* ©Copyright of Abbydale Systems LLC. */ /* */ /*-------------------------------------------------------------------*/ Parse upper Arg Help pool /* Check for Help */ If Help = "?" Then do Call Disp_Help exit(4) end signal on halt /* attention key */ tcb = ptr(540) /* Address of TCB (PSATOLD) */ jscb = ptr(tcb+180) /* Jscb tcbjscb */ tiot = ptr(tcb+12) /* Address of TIOT (TCBTIO) */ tioentry = tiot+24 /* Address of 1st TIOT entry */ tioelngh = C2D(stg(tioentry, 1)) /* TIOT entry length */ if Help = "" then do do forever Say "DDName to check. Enter or to exit" parse upper pull Ans if Ans = "" then exit(8) if Ans = "" then exit(8) if length(ans) > 8 then do say "Invalid DDname entered." end else do if substr(Ans,1,1) > 0 then do say "Invalid character found in DDNAME" end else do leave end end end end else do ans = help end found = 0 do until tioelngh == 0 thisddname = strip(stg(tioentry+4,8)) if left(thisddname, 1) == '00'x then do /* Valid DD entry? */ tioentry = tioentry+tioelngh /* Next TIOT entry */ tioelngh = c2d(stg(tioentry, 1)) /* TIOT entry length */ iterate end if thisddname = Ans then do /* Is it ours? */ svatoken = stg(tioentry+12,3) /* TIOEJFCB SVA address token*/ jfcb = swareq(svatoken) /* Convert into JFCB address */ dsname = stg(jfcb, 44) /* dataset name */ dsname = strip(dsname,'T') found = 1 leave end tioentry = tioentry+tioelngh /*Next TIOT entry*/ tioelngh = c2d(stg(tioentry, 1)) /*TIOT entry length */ end if found = 0 then do xdsn = "DDNAME not found" end else do xdsn = dsname end xdsn = strip(xdsn) if Help = "" then do say xdsn end else do push xdsn end return ptr: Return C2D(storage(D2X(ARG(1)),4)) stg: Return storage(d2x(arg(1)),arg(2)) swareq: parse arg svatoken if right(c2x(svatoken),1) \= 'F' then /* Swa=Below ? */ thisjfcb = c2d(svatoken)+16 else do /* SWA is above 16MB line. */ sva = c2d(svatoken) /* Convert to decimal */ nextqmat = qmat do while sva>65536 nextqmat = ptr(nextqmat+12) /* Next qmat qmat+12 */ sva=sva-65536 /* 010006F -> 000006F */ end thisjfcb = ptr(qmat+sva+1)+16 /* JFCB in 31 bit address */ end return thisjfcb /*-------------------------------------------------------------------*/ /* Disp_Help Procedure */ /*-------------------------------------------------------------------*/ Disp_Help: Procedure say "GETDSN -" say"" say "Usage: GETDSN xxxxx | ?" say"" say" ? - Generates this information." say"" say" Return Codes :" say" 4 - Help displayed" say" 16 - Not under ISPF" 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 GETDSN */ /*-------------------------------------------------------------------*/