From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 22-JUL-1992 12:30:38.43
To:	info-vax@cdclu1.genrad.com
CC:	DONGRAY@cdclu1.genrad.com
Subj:	Re: GETDVIW question

[...]
>                                                        One of the things
> that I need to do is check to see if one of the four tape drives is
> online and available. I am using the SYS$GETDRVIW System Service Routine to
> check to see that the drive is NOT allocated, and thus capable of being
> used. My problem is that the VAX that this will be running on is actually
> a VAXCluster, consiting of two nodes. According to the Documentation and
> my own testing, if a drive is allocated to a user on another node, GETDVIW
> is unable to determine whether or not the drive has been allocated.
[...]

> Marc Zampetti
> System Administrator - PMW
> Wharton - The University of Pennsylvania

My initial thought was to get the device's lock name using $getdvi then use
$enq to try to obtain a lock and if it failed ...

Then it occured to me! If all you want to know is "is it allocated?", then
what's wrong with ...

	char device[] = "CD4000$MUA0:";		/* cluster served tape */
	$DESCRIPTOR(d_device,device);
	int status;
/*...*/
	status = sys$alloc(&d_device,0,0,0,0);
	if ((status&1)==1) {			/* success of some kind */
		sys$dalloc(&d_device,0);	/* give it back */
		printf("%s is free for allocation.\n",device);
	} else
		printf("%s is currently unavailable.\n",device);
/*...*/

Simple and it saves reinventing the wheel! :-)

--------------------------------------------------------------------------------
Name : Derek Dongray, Systems Manager, GenRad Ltd.
Phone : 061 486 1511 ext 166
PSS : 234261600119::Dongray                 UKnet : Derek.Dongray@GenRad.co.uk
InterNet : Dongray@cdclu1.GenRad.com        CompuServe : 70374,2745
Address : Monmouth House, Monmouth Road, Cheadle Hulme, Cheshire, SK8 7AY, UK.

