/* REXX *** */ PARSE SOURCE . . . . . . Envir . If Envir \= 'SH' then , IF SYSCALLS('ON')>3 Then Do SAY 'Unable to establish the SYSCALL environment' Exit 8 End PARSE ARG uid /* option uid option */ /* Call Assembler program to extract ps information for OMVS */ Address TSO 'ALLOC FI(OUTPUT) UNIT(VIO) REU BLKSIZE(0)' If rc \= 0 then Do Say 'Problem allocating work dataset' Exit 8 End tzoff = tzsecs() /* seconds */ /* call the load library */ Address TSO "CALL (ASMPS)" 'EXECIO * DISKR OUTPUT 1 (STEM ps. FINIS)' /* Use REXX to format and interpret the results */ Numeric Digits 10 /* large process numbers */ Say Left('Jobname',8) 'Asid' Right('Pid',10) Right('PPid',10) , 'ST' Right('EUid',5) Right('RUid',5) 'Server' Address SYSCALL Do i = 1 to ps.0 SELECT WHEN LEFT(ps.i,3) = 'BUF' Then Do If C2D(Substr(ps.i,4,1)) > 128 then Swap = 'S' else Swap = ' ' Status = Substr(ps.i,7,1) Job = Substr(ps.i,144,8) Server = Substr(ps.i,96,32) EUid = C2D(Substr(ps.i,28,4)) if uid \= '' & , /* option to select by uid */ uid \= EUid then iterate Asid = C2X(Substr(ps.i,156,2)) Pid = C2D(Substr(ps.i,8,4)) PPid = C2D(Substr(ps.i,12,4)) RUid = C2D(Substr(ps.i,32,4)) Say Job Asid Right(Pid,10) Right(PPid,10) , Swap||Status Right(EUid,5) Right(RUid,5) Left(Server,28) 'gmtime 'C2D(Substr(ps.i,56,4))+tzoff' gm.' /* display fmt */ day = right(gm.tm_mday,2,0) /* derive day */ min = right(gm.tm_min,2,0) /* derive min */ mo = right(gm.tm_mon,2,0) /* derive month */ hr = right(gm.tm_hour,2,0) /* derive hour */ on = gm.tm_year'/'mo'/'day' 'hr':'min /* add system plus user CPU time */ tskt = C2D(Substr(ps.i,60,4))+C2D(Substr(ps.i,64,4)) t=(tskt + 50) % 100 /* change time to seconds */ mm = t%60 /* derive minutes */ ss = t//60 /* derive seconds */ hh = mm%60 /* derive hours */ mm = mm//60 /* derive minute remainder */ if hh=0 then , /* set hours: samp ignores day */ h=' ' else , h=right(hh,2,0)':' m=right(mm,2,0)':' /* set minutes */ 'getpwuid 'EUid' pwr.' /* who are we ? */ if retval = 0 then , Ename = ' ' else , Ename = pwr.pw_name 'getpwuid 'RUid' pwr.' /* who are we ? */ if retval = 0 then , Rname = ' ' else , Rname = pwr.pw_name EGid = C2D(Substr(ps.i,40,4)) 'getgrgid 'EGid' gr.' /* who are we ? */ Say 'CPU='h||m||right(ss,2,0)' Start='on Ename Rname , gr.gr_name End WHEN LEFT(ps.i,3) = 'TTY' Then Do if uid \= '' & , /* option to select by uid */ uid \= EUid then iterate If Length(ps.i) > 7 then , Say 'Tty' Substr(ps.i,8) End WHEN LEFT(ps.i,3) = 'PTH' Then Do if uid \= '' & , /* option to select by uid */ uid \= EUid then iterate Svpath = Substr(ps.i,8) Say 'Path 'Svpath End WHEN LEFT(ps.i,3) = 'CMD' Then Do if uid \= '' & , /* option to select by uid */ uid \= EUid then iterate tlen = C2D(Substr(ps.i,4,4))+4 cmd = '' Do op = 8 While (op + 3) < tlen oplen = C2D(Substr(ps.i,op,4)) If (op+oplen) <= tlen then , cmd = cmd' 'Substr(ps.i,op+4,oplen-1) op = op + oplen+3 End op If Svpath \= cmd then , Say 'Command'cmd End OTHERWISE Say 'Unexpected input 'LEFT(ps.i,3) END End i Address TSO , 'FREE FI(OUTPUT)' Exit 0