Article 141735 of comp.os.vms:
Path: nntpd.lkg.dec.com!depot.mro.dec.com!news.jrd.dec.com!tbjnws.tbj.dec.com!tkonws.tko.dec.com!news.dec-j!spin-hsd0-tky!spinnews!wnoc-tyo-news!wnoc-sfc-news!ricohwgw!ricrdc1!ohmori.ricoh!news.src.ricoh!ricohgwy.ricoh!news.iij.ad.jp!rim.or.jp!news.kddnet.ad.jp!imci5!imci4!newsfeed.internetmci.com!chi-news.cic.net!nntp.coast.net!lll-winken.llnl.gov!fnnews.fnal.gov!nntp-server.caltech.edu!SOL1.GPS.CALTECH.EDU!CARL
From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
Newsgroups: comp.os.vms
Subject: Re: Volume label of unmounted disk
Date: 5 Mar 1996 09:27:09 GMT
Organization: HST Wide Field/Planetary Camera
Lines: 56
Distribution: world
Message-ID: <4hh1dd$e1k@gap.cco.caltech.edu>
References: <1996Mar5.131208.333@southpower.co.nz>
Reply-To: carl@SOL1.GPS.CALTECH.EDU
NNTP-Posting-Host: sol1.gps.caltech.edu

In article <1996Mar5.131208.333@southpower.co.nz>, buxtonr@southpower.co.nz writes:
=Does anyone know the location of any software that can return
=the label on an unmounted disk.

Assuming the primary home block is valid:

#include descrip
#include iodef

getvolnam(struct dsc$descriptor *devnam, struct dsc$descriptor *volnam)
{	unsigned char buff[512];
	unsigned long stat;
	unsigned short iosb[4], chan;
	$DESCRIPTOR(name, buff);
	int i;

	if((SYS$ASSIGN(devnam, &chan, 0, 0) & 7) != 1)
		return 0;
	if((SYS$QIOW(0, chan, IO$_PACKACK, iosb, 0, 0, 0, 0, 0, 0, 0, 0)
		& 7) != 1)
		return 0;
	if((iosb[0] & 7) != 1)
		return 0;
	if((SYS$QIOW(0, chan, IO$_READLBLK, iosb, 0, 0, buff, 512, 1, 0, 0, 0)
		& 7) != 1)
		return 0;
	if((iosb[0] & 7) != 1)
		return 0;
	SYS$DASSGN(chan);
	name.dsc$a_pointer = buff + 472;
	name.dsc$w_length = 12;
	for(i = 11; (i >= 0) && (name.dsc$a_pointer[i] == ' '); i--);
	i++;
	if(i == 0)
		return 0;
	name.dsc$w_length = i;
	if((STR$COPY_DX(volnam, &name) & 7) != 1)
		return 0;
	return 1;
}

Of course, if you REALLY want to get the info about a disk that's not mounted,
then you'd be better off doing a mount and a dismount.  The above routine was
written as part of a program that will let you MOUNT/CLUSTER a disk that's
already mounted on another node in the cluster but not on the local node. 
Having the disk mounted on another node prevents you from mounting the disk
/FOREIGN or /OVER=ID to get its label, so the above unsupported technique
becomes more or less necessary.
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL

Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
understanding of astronomy is purely at the amateur level (or below).  So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it.  If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.


