/* REXX - +------------------------------------------------------------------+ Name: TSURXS Type: REXX exec Purpose: Display TSO userid from the OUCB Release: OS/390 2.4 Programmer: John Kalinich Date: 04/28/99 Abstract: Display all TSO userids in sorted order Call Format: TSURX Logic: Extracts the CVT (at x'10') Extracts the ASVT (CVT+x'22C') Extracts first available ASVT entry (ASVT+x'20C') .---> Extracts the next ASCB in vector table Extracts the OUCB (ASCB+x'90') '---- Extracts OUCBUSRD +------------------------------------------------------------------+ */ Arg Trace Numeric Digits 10 cvt_ptr = Get_ptr(10,0) asvt_ptr = Get_ptr(cvt_ptr,'22c') max_users = X2d(Get_ptr(asvt_ptr,'204')) /* Max ASID's */ asvt_frst_ptr = D2x(x2d(asvt_ptr) + x2d(20c)) /* ASVTFRST */ /* Master Scheduler, ASID=1, ASVT+x'210' */ count = 0 userid. = '' Do max_users asvt_frst_ptr = D2x(X2d(asvt_frst_ptr) + X2d(4)) /* Next ASID */ ascb_ptr = Get_ptr(asvt_frst_ptr,0) If Bitand(Left(X2c(ascb_ptr),1),'80'x) = '80'x /* Available ASID */ Then Iterate ascb_jbns_ptr = Get_ptr(ascb_ptr,'b0') If ascb_jbns_ptr = '00000000' Then /* No jobname */ Iterate oucb_ptr = Get_ptr(ascb_ptr,'90') oucb_yfl = Get_data(oucb_ptr,'12',1) If Bitand(oucb_yfl,'20'x) <> '20'x Then /* Not a Logon */ Iterate oucb_usrd = Get_data(oucb_ptr,'d0',8) If Left(oucb_usrd,1) = '40'x Then /* No userid */ Iterate count = count + 1 userid.count = oucb_usrd End Call Sort_Userids Say count 'TSO Users:' Call Print_Userids Exit Sort_Userids: /* Bubble sort */ last = count - 1 Do x = 1 to last Do y = x to last z = y + 1 If userid.x > userid.z Then Do userid.hold = userid.x userid.x = userid.z userid.z = userid.hold End End End Return Print_Userids: /* 8 to a line */ line = '' Do x = 1 to count line = line userid.x If x // 8 = 0 Then Do Say line line = '' End End Say line Return 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 list TSO users (sorted by userid) */