[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

137.0. "Auto WS device creation/managment" by VINO::WITHROW (Robert Withrow) Mon Feb 06 1989 17:38

I have cobbled together an unsavory command procedure that creats the
WS: device for me when I log into a host from a workstation using
decterm.  What I am trying to achieve is this:

  1) only create a WS device (using set display/create) when I
    am hosting in from a workstation.
  2) re-use an existing WS device if there is one for my UIC and
    attached to the correct node.

I have succeeded at 2) by the sly expediency of parsing the
output of a) show devices, to find a list of ws devices, and
b) parsing the output of show display, to find out what node
the ws device is connected to.

I have two questions:

  - How can I do 1) above using ONLY DCL.  I.E. what happens
  if I do an "$ open foo node::"task=x0$0" or something like
  that.  Will the success/failure of that always tell me if
  I am talking to a workstation?

  - Is the a less "sleasy" way of doing 2) than by parsing
  the output of DCL commands?

T.RTitleUserPersonal
Name
DateLines
137.1FIND_DISPLAY.COMBOMBE::MOORESo many holes to plugMon Feb 06 1989 19:4683
    Well, here is a version of "find an existing display", adapted from
    REMCHILD.COM...
    
$ !   FIND_DISPLAY.COM
$ ! This command file will look at all the _WSAx's that are already
$ ! defined on the system for your own.  If it finds one, great - if
$ ! not, it will create one for you.
$ !
$ ! Input parameter P1 format:   "node::server.screen"
$ !                  defaults:               0.0
$ !
$ Set NoOn
$ FILTER = "uncomment,upcase,collapse"	! for F$EDIT()
$ MY_UIC = f$getjpi("","uic")
$ MY_PID = f$getjpi("","pid")
$ DEVICES_FILE = "SYS$SCRATCH:DEVICES_" + MY_PID + ".TMP;"
$ if P1 .eqs. "" 
$    then 
$    if (f$mode() .nes. "INTERACTIVE") -
     .or. .not. f$getdvi("SYS$COMMAND","trm") then Exit
$    Read/Error=QUIT SYS$COMMAND P1 /Prompt="_Node? (Name of YOUR workstation) " 
$    endif
$ P1 = f$edit(P1,FILTER)
$ MY_NODE = f$element(0,":",P1) - ":"
$ if MY_NODE .eqs. "" then Exit
$ MY_SERVER = f$element(2,":",P1) - ":"
$ MY_SCREEN = f$element(1,".",MY_SERVER) - "."
$ MY_SERVER = f$element(0,".",MY_SERVER) - "."
$ if MY_SERVER .eqs. "" then MY_SERVER = "0"
$ if MY_SCREEN .eqs. "" then MY_SCREEN = "0"
$ MY_DISPLAY = f$fao("!AS::!AS.!AS", MY_NODE, MY_SERVER, MY_SCREEN)
$ WILDCARD_MODE = (f$locate("*",MY_DISPLAY) .lt. f$length(MY_DISPLAY))
$ CANDIDATES = ""
$
$ Define/User SYS$OUTPUT 'DEVICES_FILE'
$ Show Device WSA
$ Open/Read/Error=QUIT DEV_LIST 'DEVICES_FILE'
$ ! search for the node 'MY_NODE' amungst the devices already created
$NEXT_DEV:
$ Read/Error=NO_MOORE_DEVS  DEV_LIST  DEV
$ if f$locate(":",DEV) .ge. f$length(DEV) then Goto NEXT_DEV
$ DEV = f$element(0,":",f$edit(DEV,FILTER))
$ if .not. f$getdvi(DEV,"EXISTS") .or. (f$getdvi(DEV,"ownuic") .nes. MY_UIC) then -
	Goto NEXT_DEV
$! This may be the one...
$ Define/User SYS$OUTPUT NL:
$ Show Display/Symbol 'DEV'
$ if (DECW$DISPLAY_NODE .nes. MY_NODE) .and. (MY_NODE .nes. "*") then Goto NEXT_DEV
$ if (DECW$DISPLAY_SERVER .nes. MY_SERVER) .and. (MY_SERVER .nes. "*") then Goto NEXT_DEV
$ if (DECW$DISPLAY_SCREEN .nes. MY_SCREEN) .and. (MY_SCREEN .nes. "*") then Goto NEXT_DEV
$!$ if DECW$DISPLAY_TRANSPORT .nes. "DECNET" then Goto NEXT_DEV
$ CANDIDATES = DEV + "," + CANDIDATES
$ Goto NEXT_DEV
$
$NO_MOORE_DEVS:
$!	Pick most recent device from candidate list
$ DEV = f$element(0,",",CANDIDATES) - ","
$ if DEV .eqs. "" then Goto CREATE_NEW_DISPLAY
$
$ Write SYS$OUTPUT "Using existing display device - ",DEV
$ if WILDCARD_MODE then Show Display 'DEV':
$ Define/Job/NoLog DECW$DISPLAY 'DEV':
$ Define/Process/NoLog DECW$DISPLAY 'DEV':
$ Goto DONE
$
$CREATE_NEW_DISPLAY:
$ if .not. WILDCARD_MODE
$    then
$    Write SYS$OUTPUT "Creating new display device for ",MY_DISPLAY
$    Set Display/Create /Node='MY_NODE' /Server='MY_SERVER' /Screen='MY_SCREEN'
$ else
$    ! Wildcard mode - Do not create new display, just report none found...
$    Write SYS$OUTPUT "Could not find any display device matching ",MY_DISPLAY," for user ",MY_UIC
$    endif
$
$DONE:
$ Show Logical DECW$DISPLAY
$
$QUIT:
$ Close/NoLog DEV_LIST
$ if f$search(DEVICES_FILE) .nes. "" then DELETE/NOLOG 'f$parse(";*",DEVICES_FILE)'
$ Exit

137.2FORTY2::SHIPMANTue Feb 07 1989 05:5732
I used to use a similar procedure to .1, but with other people gaily creating
WS devices every time they logged in, it could take rather a long time to find
mine.  We ended up with hundreds of the little devils on our 8800, and that was
with relatively frequent reboots.

Eventually I changed over to only ever do a SET DISPLAY from a command
procedure, and remember what I'd done in the group logical name table.  After
all, I wasn't particularly interested in typing the SET DISPLAY command anyway. 
Here's the procedure; it takes one parameter, the server's nodename.

Nick.

$ transport = "DECNET"
$ if p1 .nes. "" then goto gotnode
$ p1 = f$trnlnm ("SYS$NODE")
$ transport = "LOCAL"
$gotnode:
$ if f$locate ("_", p1) .ne. f$length (p1) then -
    p1 = f$extract (1, f$length (p1) - 1, p1)
$ if f$locate ("::", p1) .ne. f$length (p1) then -
    p1 = f$extract (0, f$length (p1) - 2, p1)
$ user = f$edit (f$getjpi ("", "USERNAME"), "COLLAPSE")
$ lognam = "DW$''p1'_''user'"
$ if .not. f$getdvi ("''lognam'", "EXISTS") then goto create_display
$ define/nolog decw$display 'f$trnlnm (lognam)
$ goto got_display
$create_display:
$ set display/create/node='p1/transport='transport
$ define/group 'lognam 'f$trnlnm ("DECW$DISPLAY")
$got_display:
$ write sys$output "DECW$DISPLAY is ''f$trnlnm (""DECW$DISPLAY"")"

137.3Yes, but not what I am looking for.VINO::WITHROWRobert WithrowTue Feb 07 1989 11:2914
RE: .1 and .2...

Yes, I've done something similar, except that I use sys$rem_node instead
of asking the user for it, and my procedure is a whole lot less chatty.

What I am aiming for is to have it be totally automagic.  I do not want
to create a new display device if the remote is NOT A WORKSTATION, and I
dont want to prompt the user for ANYTHING.

I was sort of hoping that there was a f$getdvi item I could query, or
that I could open the server, or something.

Thanks for the replys though!

137.4A procedure to get rid of "little devils" (unused WSAn: devices)IO::MCCARTNEYJames T. McCartney III - DTN 381-2244 ZK02-2/N24Thu Feb 09 1989 16:3939
$ !+++	CHECK_WSA_REFCNT.COM - Check reference count and kill unused displays.
$ !
$ ! New with DECwindows is a neat little device called WSA0. 
$ !
$ ! The problem is that you must delete the workstation device one all channels
$ ! have been closed. This is easily accomplished by SET DISPLAY/NOPERM but if
$ ! you have herds of droidheads that don't even know what the PURGE verb does,
$ ! then this command file may be what your looking for. 
$ ! 
$ ! Just send $19.95 before midnight tonight to...
$ !
$ show device/output=sys$scratch:s'f$getjpi("","PID")'.tmp wsa
$ open devices sys$scratch:s'f$getjpi("","PID")'.tmp 
$ 
$ Loop: - wouldn't it really be neat if DCL had one of these????
$  !
$  ! Check to see if we have found any workstation devices. Skip WSA0.
$  !
$  read/end=exit_loop devices inline
$  name = f$element(0,":",inline)
$  if f$extract(0,3,inline) .nes. "WSA" then goto loop
$  if name .eqs. ":" then goto loop
$  if f$getdvi(name,"unit") .eq. 0 then goto loop
$  if f$getdvi(name,"refcnt") .eq. 0
$  then
$   !
$   ! We will release this device since it's not being used.
$   ! 
$   write sys$output "Releaseing display ''name'."
$   set display 'name'/noperm
$  else
$   write sys$output "Display ''name' still has channels assigned."
$  endif
$  goto loop
$ exit_loop:
$ close devices
$ delete sys$scratch:s'f$getjpi("","PID")'.tmp;*
$ exit