$ vf='f$verify(0)'
$ !
$ !  Purpose       : show who is on the system
$ !  Author        : Arne Vajhøj
$ !  Last modified : 24/05/94
$ !  Usage         : @WHO_IS_ON or @WHO_IS_ON S
$ !  Remarks       : need WORLD priv
$ !
$ wp=f$priv("WORLD")
$ prv=f$getjpi("","AUTHPRIV")
$ if f$locate("SETPRV",prv) .lt. f$length(prv) then set process/priv=world
$ w:=write sys$output
$ maxcpu=1800
$ maxws=4096
$ xun=f$getjpi("","USERNAME")
$ xlogin=f$getjpi("","LOGINTIM")
$ xloginday=f$cvtime(xlogin,,"DAY")
$ csi[0,8]=155
$ end=csi+"0m"
$ w "System activity "+f$time()
$ w ""
$ w "M Node   Username     Process Name      Pid       CPU   Mem Image"
$ w ""
$ ncntx=""
$ cluster=f$getsyi("CLUSTER_MEMBER")
$ loop1:
$    cntx=0
$    if cluster
$    then
$       csid=f$csid(ncntx)
$       if csid .eqs. "" then goto endloop1
$       node=f$getsyi("NODENAME",,csid)
$       tmp=f$context ("PROCESS",cntx,"NODENAME",node,"EQL")
$    else
$       node=f$getsyi("NODENAME")
$    endif
$    tmp=f$context ("PROCESS",cntx,"USERNAME","*","EQL")
$    loop2:
$       pid=f$pid(cntx)
$       if pid .eqs. "" then goto endloop2
$       mode=f$getjpi(pid,"MODE")
$       mode1=f$extract(0,1,mode)
$       if p1 .eqs. "" .and. (mode1 .eqs. "O" .or. mode1 .eqs. "N") then -
         goto loop2
$       un=f$getjpi(pid,"USERNAME")
$       pn=f$getjpi(pid,"PRCNAM")
$       cpu=f$getjpi(pid,"CPUTIM")/100
$       ws=f$getjpi(pid,"WSSIZE")
$       imag=f$parse(f$getjpi(pid,"IMAGNAME"),,,"NAME")
$       if imag .eqs. "" then imag="<dcl>"
$       login=f$getjpi(pid,"LOGINTIM")
$       loginday=f$cvtime(login,,"DAY")
$       start=csi+"0m"
$       if un .eqs. xun then start=csi+"1m"
$       if cpu .gt. maxcpu .or. ws .gt. maxws .or. -
         (loginday .nes. xloginday .and. -
         mode1 .nes. "O" .and. mode1 .nes. "N") then -
         start=csi+"7m"
$       w f$fao("!AS!1AS !6AS !12AS !15AS !8AS !6SL !5SL !AS!AS", -
             start,mode,node,un,pn,pid,cpu,ws,imag,end)
$       goto loop2
$    endloop2:
$    if cluster then goto loop1
$ endloop1:   
$ if .not. wp then set process/priv=noworld
$ if vf then exit f$verify(1)+1
$ exit 1
