From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 21-SEP-1990 12:05:01.89
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	RE: Playing With DECWindows

Received:  by crdgw1.ge.com (5.57/GE 1.73)
	 id AA16657; Fri, 21 Sep 90 11:52:18 EDT
Received: From SLCS.SLB.COM ([128.58.3.3]) by CRVAX.SRI.COM with TCP; Fri, 21 SEP 90 08:21:58 PDT
Received: from sndrtr.psi
	by SLCS.SLB.COM (4.1/SLCS Mailhost 3.6)
	id AA12249; Fri, 21 Sep 90 10:16:34 CDT
Date: Fri, 21 Sep 90 10:16:34 CDT
From: brydon@asl.SINet.SLB.COM (Real computers use kilowatts)
Message-Id: <9009211516.AA12249.brydon@asl.SINet.SLB.COM@SLCS.SLB.COM>
To: info-vax@kl.sri.com
X-Vms-To: M_MAILNOW::M_INTERNET::"info-vax@kl.sri.com"
Subject: RE: Playing With DECWindows

I tried sending this to ucbvax.Berkeley.EDU::agate::agate::jym, but it keeps
bouncing...

Jym writes:

>.-.
>|1| On Unix, you can run rsh on another machine and have a detached
>`-' process on that machine run an X client displaying on another
>    machine.  Has anyone done a similar thing on VMS?  I know I can
>    log in on the other machine and SET DISPLAY/CREATE, but I'd like
>    to know the best way to do it without having to stay logged in
>    there.  Do I need something like a detached job running LOGINOUT
>    and executing the SET DISPLAY command?  Any special requirements
>    if the client I want to run is DECterm?

I use the following for creating a remote DECwindows session on another
machine.  Put in your sys$login directory on the remote system and execute it
interactively on the local system.

Harvey Brydon
Schlumberger Anadrill
200 Macco Blvd
Sugar Land, TX 77478
(713)240-4949

=============================================================================
$ ver = f$verify(0'decw_vue_ver')
$!
$! DECW_VUE.COM - command procedure used in interactive, batch and network mode
$! to request and service DECwindows connection between two different nodes.  It
$! is assumed that if we are in interactive mode we are local, initiating a
$! remote request and that batch and network mode always service the request on
$! the remote end. 
$!
$! Written: 90/05/18 H. Brydon
$!
$! Modified:
$!  90/07/03-09 H. Brydon
$!	add decterm terminal characteristics
$!  90/06/20 H. Brydon
$!	apply VMS/DECW V5.3 update
$!  90/06/11 H. Brydon
$!	add timeout on network read, make fix to batch filename
$!  90/06/01 H. Brydon
$!	add DECTERM code,
$!	ask for password if null and username is non-null,
$!	add ctrl-y handling
$!
$!
$ close		:= close
$ define	:= define
$ exit		:= exit
$ goto		:= goto
$ if		:= if
$ logout	:= logout
$ mcr		:= mcr
$ on		:= on
$ open		:= open
$ read		:= read
$ run		:= run
$ set		:= set
$ show		:= show
$ submit	:= submit
$ write		:= write
$
$ on control_y then goto exit
$ set noon
$ if f$mode() .eqs. "INTERACTIVE" then goto localjob
$ if f$mode() .eqs. "BATCH" then goto remote_batch
$ if f$mode() .eqs. "NETWORK" then goto remote_net
$ write sys$output 'f$mode()'
$ show proc/all
$ logout /full
$
$localjob:
$ if p1 .nes. "" then goto gotnode
$ read sys$command p1 /prompt="What remote node: "
$ if p3 .eqs. "" then read sys$command p3 /prompt="Remote username : "
$gotnode:
$ if p3 .eqs. "" then goto got_pswd
$ if p4 .nes. "" then goto got_pswd
$ set term /noecho
$ read sys$command p4 /prompt="Remote password : "
$ set term /echo
$got_pswd:
$ rnode = f$edit(p1,"upcase,uncomment,collapse") - "::"
$ if rnode .eqs. "" then goto exit
$ appl = f$edit(p2,"upcase,uncomment,compress")
$ unam = f$edit(p3,"upcase,uncomment,collapse")
$ pswd = f$edit(p4,"upcase,uncomment,collapse")
$ if f$trnlnm("remnode") .nes. "" then close /nolog remnode
$ string = "''rnode'::"
$ if unam .nes. "" then string = "''rnode'""""''unam' ''pswd'""""::"
$ define /user rnode "''string'"
$ open /read /write /error=NONET remnode rnode::"task=decw_vue"
$ write remnode appl
$readloop:
$ read /timeout=180 /error=net_error /end=eof remnode line
$ write sys$output line
$ goto readloop
$eof:
$ close /nolog remnode
$ goto exit


$remote_batch:
$ set verify
$ rnode = f$edit(p1,"upcase,uncomment,collapse")
$ appl = f$edit(p2,"upcase,uncomment,collapse")
$ goto batch_net_common



$remote_net:
$ set verify
$ lnode = f$trnlnm("sys$rem_node") - "::"
$ open /read /write /error=net_error instr SYS$NET
$ read /time_out=180 /error=net_error /end=endline instr appl
$
$batch_net_common:
$ if f$trnlnm("decw$system_defaults") .eqs. "" then goto no_decw
$ if f$search("sys$system:vue$master.exe") .eqs. "" then goto no_decw
$ if appl .eqs. "DECTERM" then goto create_decterm
$ file = f$parse(appl,".exe",,,"SYNTAX_ONLY")
$ if f$search("''file'") .eqs. "" then -
  file = f$parse(appl,"sys$system:.exe",,,"SYNTAX_ONLY")
$ if f$search("''file'") .nes. "" then goto create_display
$
$ if f$mode() .eqs. "NETWORK" then define /user sys$output instr
$ write sys$output -
  "Valid application not specified, starting up VUE session"
$ appl = "vue$master"
$
$create_display:
$ close /nolog instr
$ set display /create /transport=decnet /node='lnode'
$ on warning then goto notfound
$ mcr 'appl'
$ logout /full
$!$ goto exit

$create_decterm:	! (VMS V5.3 and later)
$ close /nolog instr
$ rnode = f$trnlnm("sys$node") - "::" - "_"
$ uname = f$edit(f$getjpi("","USERNAME"),"trim")
$ pid4 = f$extract(4,4,f$getjpi("","PID"))
$ set proc /name="DECterm_''pid4'"
$ show time
$ create /terminal=decterm /display='lnode'::0 /broadcast /wait -
  /window=(title="''rnode'::''uname'",icon="''rnode'::''uname'")
$ show time
$ logout/full


$no_decterm:
$ if f$mode() .eqs. "NETWORK" then define /user sys$output instr
$ write sys$output -
  "DECterm cannot be activated on this system, aborting request"
$ logout /full

$no_decw:
$ if f$mode() .eqs. "NETWORK" then define /user sys$output instr
$ write sys$output -
  "DECwindows not installed on this system, aborting request"
$ logout /full

$notfound:
$ write sys$output "Error, application not found, exiting"
$ logout /full

$net_error:
$ write sys$output "Network error, aborting"
$ close /nolog instr 
$ if f$mode() .eqs. "INTERACTIVE" then goto exit
$ logout /full

$nonet:
$ write SYS$OUTPUT "Error, unable to open network link."
$exit:
$ set term /echo
$ exit f$verify(ver).or.1

