rexx-things/samples/mvs/gettrid.rex
2025-03-12 20:50:48 +00:00

60 lines
2.6 KiB
Rexx

/* REXX -
statistics 0122-92148-93314-0817-00056-00087-00000-REXX
sys6.cbt.file078(rexx)
returns the name of the terminal -- e.g.
terminal = gettrid(); say terminal
+------------------------------------------------------------------+
| Name: GETTRID |
| Type: REXX exec |
| Purpose: Extract the ACEETRID from the RACF ACEE. |
| Release: MVS/ESA v4.2.2 and TSO/E v2.4 |
| Programmer: John Kalinich |
| Date: 3/10/93 |
| Abstract: A sub-function to extract the VTAM terminal id from |
| the RACF Accessor Environment Element. The ACEE is |
| not fetch protected. This function works in ACF2 |
| systems. |
| |
| Call Format: GETTRID() |
| |
| Logic: Extracts address of ASCB (PSAAOLD at x'224') |
| Extracts address of ASXB (ASCB+x'6C') |
| Extracts address of ACEE (ASXB+x'C8') |
| Extracts ACEETRID |
+------------------------------------------------------------------+ */
trace
ascb_ptr = get_ptr(224,0)
asxb_ptr = get_ptr(ascb_ptr,'6c')
acee_ptr = get_ptr(asxb_ptr,'c8')
aceetrid = get_data(acee_ptr,'40',8)
exit aceetrid
/* +-----------------------------------------+
| Procedures and functions defined below. |
+-----------------------------------------+ */
get_ptr: procedure
/* +-----------------------------------------+
| returns a 4 byte pointer as hexadecimal |
| string at address addr+offset. |
| ADDR and OFFSET must be HEX strings. |
+-----------------------------------------+ */
arg addr, offset
temp = d2x(x2d(addr) + x2d(offset))
return c2x(storage(temp,4))
exit
get_data: procedure
/* +-----------------------------------------+
| returns LENGTH bytes at ADDR+OFFSET as |
| an EBCDIC string. |
| ADDR and OFFSET must be HEX strings. |
| LENGTH must be a decimal string. |
+-----------------------------------------+ */
arg addr, offset, length
temp = d2x(x2d(addr) + x2d(offset))
return storage(temp,length)
exit
/* J. KALINICH, X4521 */
/* EXEC TO GET THE RACF ACEE TERMINAL ID */