From:	SMTP%"mvbr@se.alcbel.be"  6-JUL-1993 08:58:54.94
To:	EVERHART
CC:	
Subj:	Here is a sho_process tool

From: mvbr@se.alcbel.be (Marc Verbruggen)
X-Newsgroups: comp.os.vms
Subject: Here is a sho_process tool
Message-Id: <1790@se.alcbel.be>
Date: 5 Jul 93 09:24:26 GMT
Sender: root@se.alcbel.be
Reply-To: mvbr@se.alcbel.be (Marc Verbruggen)
Organization: Alcatel Bell
Lines: 106
Nntp-Posting-Host: se
To: Info-VAX@kl.sri.com
X-Gateway-Source-Info: USENET


--
Below you find a command procedure to display information on selected
process in a Cluster.
Comments or improvements are always welcome.

-----------------------------------------------------------
Marc Verbruggen                 tel : 03.240.94.19
Alcatel Bell Telephone          fax : 03.240.99.50
F. Wellesplein 1                email : mvbr@se.alcbel.be
B-2018 Antwerp
Belgium
 
"System Manager's Headaches Are Not Cured With Aspirin,
 There Is A Better Way ..."

-------------------cut below this line-------------------------
$!-------------------------------------------------------------------
$!
$! Utility to show information on selected processes in a cluster
$!
$! Usage : @<commandfile> [-h] [-u username] [-i imagename] [-n nodename] [-p processname]
$!
$!         The various items (username, ...) may contain parts of the full names
$!
$!-------------------------------------------------------------------
$ on control_y then goto ctrly
$ img = "false"
$ options = p1 + " " + p2 + " " + p3 + " " + p4 + " " + p5 + " " + p6 + " " + p7 + " " + p8
$ i = 1
$next_option:
$ option = f$edit(f$edit(f$element(i,"-",options),"TRIM"),"UPCASE")
$ if option .eqs. "-" then goto execute
$ item = f$element(0," ",option)
$ value = f$element(1," ",option)
$ gosub determine_context
$ i = i + 1
$ goto next_option
$!
$execute:
$ set term/width=132
$ write sys$output "
$ write sys$output f$fao("!10AS!15AS!9AS!9AS!15AS!25AS!8AS!5(7AS)",-
  "NodeName","ProcNam","ProcId","Owner","UserNam","ImageName","Virtpeak","  WSDEF"," WSQUOT","  WSEXT",-
  " WSSIZE","  PAGES")   
$ write sys$output f$fao("!126*-")
$loop:
$ pid = f$pid(ctx)
$ if pid .eqs. ""
$ then
$     goto endloop
$ else
$     node = f$getjpi(pid,"NODENAME")
$     proc = f$getjpi(pid,"PRCNAM")
$     user = f$getjpi(pid,"USERNAME")
$     owner = f$getjpi(pid,"OWNER")
$     image = f$parse(f$getjpi(pid,"IMAGNAME"),,,"NAME")
$     if img
$     then
$         if f$locate(image_value,image) .eqs. f$length(image) then goto loop
$     endif
$     wssize = f$getjpi(pid,"WSSIZE")
$     pages = f$getjpi(pid,"GPGCNT") + f$getjpi(pid,"PPGCNT")
$     wsquota = f$getjpi(pid,"WSQUOTA")
$     wsextent = f$getjpi(pid,"WSEXTENT")
$     wsdefault = f$getjpi(pid,"DFWSCNT")
$     virtpeak = f$getjpi(pid,"VIRTPEAK")
$     write sys$output f$fao("!10AS!15AS!9AS!9AS!15AS!25AS!8SL!5(7SL)",-
      node,proc,pid,owner,user,image,virtpeak,wsdefault,wsquota,wsextent,wssize,pages)
$     goto loop
$ endif
$endloop:
$ write sys$output ""
$exit:
$ read/prompt="Enter <CR> to exit" sys$command dummy
$ set term/width=80
$ exit
$ctrly:
$ ctrly == "true"
$ goto exit
$!
$!
$determine_context:
$ first_char = f$extract(0,1,item)
$ if first_char .eqs. "P" then item = "PRCNAM"
$ if first_char .eqs. "U" then item = "USERNAME"
$ if first_char .eqs. "" .or. first_char .eqs. "I" 
$ then 
$     item = "PRCNAM"
$     image_value = value
$     value = "*"
$     img = "true"
$ endif
$ if first_char .eqs. "N" then item = "NODENAME"
$ if first_char .eqs. "H"
$ then
$     type sys$input

  Following options are supported 

             [-u user] [-p process] [-i image] [-n node]

$ goto exit
$ endif
$ tmp=f$context("process",ctx,item,"*''value'*","EQL")
$ return

