From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM"  9-APR-1994 10:51:47.26
To:	EVERHART
CC:	
Subj:	Re: Getting mount status of a disk not mounted on the current system

From: rlboyd@mercury.interpath.net (- Personal Account)
X-Newsgroups: comp.os.vms
Subject: Re: Getting mount status of a disk not mounted on the current system
Date: 6 Apr 1994 11:24:59 -0400
Organization: Visionary Concepts & Designs, Inc.
Lines: 213
Message-Id: <2nuk8b$ln@mercury.interpath.net>
Nntp-Posting-Host: mercury.interpath.net
To: Info-VAX@CRVAX.SRI.COM
X-Gateway-Source-Info: USENET

Carl,

Some time ago I wanted to do the same thing...and other things that 
required getting info from remote systems in the cluster.  So, I
wrote a procedure to do it for me.

Here are 2 procedures that I've used for this kind of thing:

REMOTE_LEXICAL will probably do what you want, using F$GETDVI(stuff)

Enjoy,

Bob

$! ------------------ CUT HERE -----------------------
$ v='f$VERIFY(f$TRNLNM("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.2-007  22-FEB-1990
$!   On  6-APR-1994 11:18:20.83   By user RLB14162 (Bob Boyd)
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. CLUSTER_DO.COM;12
$!       2. REMOTE_LEXICAL.COM;11
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$PARSE("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$GETJPI("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$TRNLNM("SHARE_LOG") then $ w = "!"
$ ve=f$GETSYI("version")
$ if ve-f$EXTRACT(0,1,ve) .ges. "4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$VERIFY(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$SEARCH(P1) .eqs. "" then $ goto FILE_ABSENT
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete 'f'*
$ exit
$file_absent:
$ if f$PARSE(P1) .nes. "" then $ goto DIROK
$ dn=f$PARSE(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto DIROK
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ if .not. f$VERIFY() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
"output_file"));ENDPROCEDURE;Unpacker;QUIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create 'f'
X$ tvfl = f$ver(0+f$trnlnm("debug$dcl"))
X$! Do 1 or  more commands on every node in a cluster
X$! parameters:
X$!
X$! p1 - P8`09COMMANDs to be executed on all nodes.  The first null
X$!`09`09parameter ends the list.  Each command must be enclosed
X$!`09`09in quotes.
X$!
X$!`09`09If P1 is not supplied and in interactive mode then the
X$!`09`09commands will be prompted for.
X$!
X$! Author:`09Robert L. Boyd
X$!`09`09Harris Semiconductor
X$ set noon
X$ if p1.eqs.""`20
X$ then
X$`09if f$mode().eqs."INTERACTIVE"
X$`09then
X$`09  pi = 1
X$Command_loop:
X$`09  read/end=command_end/error=command_end -
X`09`09sys$command next_command/prompt="Next Command (<cr> or `5EZ to end):
V  "
X$`09  if f$edit(next_command,"trim").eqs."" then $ goto COMMAND_END
X$`09  p'pi' = next_command
X$`09  pi = 1+pi
X$`09  goto COMMAND_LOOP
X$Command_end:
X$`09else
X$`09  EXIT %x04
X$`09endif
X$ endif
X$  tmp_dir = "sys$login:"
X$  if f$edit(f$getjpi("","USERNAME"),"TRIM").eqs."SYSTEM" then -
X$`09tmp_dir = f$parse("SYS$COMMON:",tmp_dir)
X$  tmp_file = F$parse(f$getjpi("","pid")+"_cluster_do.tmp",tmp_dir)
X$  sysman_ctl = f$parse(".tmp2",tmp_file,,,"no_conceal")
X$  do_commands = f$parse(".tmp3",tmp_file,,,"no_conceal")
X$  open/write xtmp 'sysman_ctl'
X$  wx = "write xtmp"
X$  wx "$ sysman = ""$sysman"""
X$  wx "$ sysman"
X$  wx "set environment/cluster"
X$  wx "do @",do_commands
X$  close xtmp
X$ open/write xtmp 'do_commands'
X$ pi = 0
X$REM_LOOP:
X$ pi = 1+pi
X$ if f$type(p'pi').eqs."" then $ goto REM_END
X$ if p'pi'.nes."" then $ wx "$ ",p'pi'
X$ goto REM_LOOP
X$REM_END:
X$ close xtmp
X$  if f$ver().or.tvfl then $ type 'sysman_ctl'
X$  vtmp = f$ver(0)
X$  @'sysman_ctl'
X$  vtmp = f$ver(vtmp)
X$EXIT:
X$  delete 'sysman_ctl','do_commands'/nolog
X$  tvfl = f$ver(tvfl)
X$  exit`20
X$!Last Modified:  14-MAR-1990 09:32:06.33, By: RLB`20
$ CALL UNPACK CLUSTER_DO.COM;12 139211435
$ create 'f'
X$ tvfl = f$ver(0+f$trnlnm("debug$dcl"))
X$! remote_lexical
X$! parameters
X$! p1 -- remote node name
X$! p2 -- global symbol to return value to
X$! p3 -- expression to evaluate -- must be properly quoted
X$ set noon
X$ node_default = ""
X$ node_name = p1
X$ if p1.eqs.""`20
X$ then
X$   EXIT %x04
X$ else
X$   node_name = p1
X$ endif
X$ if p2.eqs.""`20
X$ then
X$ `09symbol_name = node_name+"_lexical"
X$ else
X$`09symbol_name = p2
X$ endif
X$`09EXPRESSION = P3
X$`09if expression .eqs."" then $ goto EXIT
X$
X$  tmp_file = "sys$login:"+node_name+"remote_lexical.tmp"
X$  xtmp_file = f$parse(".tmp2",tmp_file)
X$  remote_file = f$parse(".tmp3",tmp_file)
X$  open/write xtmp 'xtmp_file'
X$  wx = "write xtmp"
X$  wx "$ sysman = ""$sysman"""
X$  wx "$ sysman"
X$  wx "set environment/node=",node_name
X$  wx "do write sys$output """,symbol_name," = "",",expression
X$  close xtmp
X$  if f$ver().or.tvfl then $ type 'xtmp_file'
X$  vtmp = f$ver(0)
X$  @'xtmp_file'/output='remote_file'
X$  vtmp = f$ver(vtmp)
X$  open/read ttmp 'remote_file'
X$REMOTE_LOOP:
X$  read/end=REMOTE_END ttmp remote_line/error=REMOTE_END
X$  if tvfl .or. f$ver() then $ show symbol remote_line
X$  if f$loc(symbol_name,remote_line).ge.f$len(remote_line) then $ goto REMOT
VE_LOOP
X$  'symbol_name' == f$element(0,"(",f$element(1,"=",f$edit(remote_line,"coll
Vapse,trim")))
X$EXIT:
X$  close ttmp
X$  delete 'xtmp_file','remote_file'/nolog
X$  if tvfl .or. f$ver() then $ show sym 'symbol_name'
X$  tvfl = f$ver(tvfl)
X$  exit`20
X$REMOTE_END:
X$  'symbol_name' == ""
X$  goto EXIT
X$!Last Modified:   9-NOV-1989 16:26:22.04, By: RLB`20
$ CALL UNPACK REMOTE_LEXICAL.COM;11 154088433
$ v=f$VERIFY(v)
$ EXIT

-- 
Bob Boyd				|  Network/Systems Management Consultant
Voice:    	919-554-0043		|  Visionary Concepts & Designs, Inc.
Internet:	rlboyd@mercury.interpath.net (was: rlboyd@rock.concert.net)
USnail Mail:	438 Tyler Run Dr., Wake Forest, NC  27587

