From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 16-JUL-1992 21:11:05.06
To:	info-vax@kl.sri.com
CC:	
Subj:	Re: Remote Backups: VMS->AIX

In article <1992Jul15.163444.24269@fcom.cc.utah.edu>, tdownard@victoria.utah.edu (Tammy L Downard) writes:
>I am attempting to back up a VAX/VMS filesystem over the network to a tape
>drive on an RS6000.  I have been unable to find a way of accessing a remote
>tape device using BACKUP.  Does anyone know of a way to do this?  Any help
>would be appreciated.  

Create a DECnet object (I call it NETBACKUP on my system) pointing to the
executable created from the following program.  Then do the backup to
NODE::"0=NETBACKUP".  Note:  You'll have to change MUA0 to the name of the
appropriate tape drive on your system.

#include iodef
#include descrip
#include stdio
#include mntdef
#include dmtdef

long STAT;

#define ckstat(x) if(((STAT = (x)) & 7) != 1) MY_EXIT(STAT, fd)

test()
{	long blksiz;
	long flags = MNT$M_MESSAGE | MNT$M_OVR_IDENT;
	struct
	{	unsigned short buflen, itmcod;
		unsigned long bufadr, retadr;
	} itmlst[] =
	{	{ 4, MNT$_BLOCKSIZE, &blksiz, 0 },
		{ 4, MNT$_DEVNAM,    "MUA0",  0 },
		{ 4, MNT$_FLAGS,     &flags,  0 },
		{ 0, 0,              0,       0 }
	};
	$DESCRIPTOR(devnam, "SYS$NET");
	char buff[32767];
	char tmp[512];
	unsigned short chan;
	struct
	{	unsigned short stat;
		unsigned long count;
		unsigned short fill;
	} iosb;
	FILE *fd;

	ckstat(SYS$ASSIGN(&devnam, &chan, 0, 0));
	ckstat(SYS$QIOW(0, chan, IO$_READVBLK, &iosb, 0, 0,
		buff, 32767, 0, 0, 0, 0));
	ckstat(iosb.stat);
	sprintf(tmp, "mrs=%d", iosb.count);
	blksiz = iosb.count;
	ckstat(SYS$MOUNT(itmlst));
	if((fd = fopen("MUA0:NETBACKUP.SAV", "w", "rfm=fix", tmp)) == 0)
		SYS$EXIT(1);
	while(1==1)
	{	write(fileno(fd), buff, iosb.count);
		ckstat(SYS$QIOW(0, chan, IO$_READVBLK, &iosb, 0, 0,
			buff, 32767, 0, 0, 0, 0));
		ckstat(iosb.stat);
	}
};      

MY_EXIT(stat, fd)
long stat;
FILE fd;
{	$DESCRIPTOR(devnam, "MUA0");

	fclose(fd);
	SYS$DISMOU(&devnam, DMT$M_NOUNLOAD);
	SYS$EXIT(stat);
}
--------------------------------------------------------------------------------
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.

