From:	SMTP%"carl@SOL1.GPS.CALTECH.EDU" 10-JUN-1994 08:46:53.25
To:	EVERHART
CC:	
Subj:	Re: RMS NAM$W_DID = 0

From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
X-Newsgroups: comp.os.vms
Subject: Re: RMS NAM$W_DID = 0
Date: 10 Jun 1994 03:07:00 GMT
Organization: HST Wide Field/Planetary Camera
Lines: 68
Distribution: world
Message-ID: <2t8lck$9jk@gap.cco.caltech.edu>
Reply-To: carl@SOL1.GPS.CALTECH.EDU
NNTP-Posting-Host: sol1.gps.caltech.edu
To: Info-VAX@CRVAX.SRI.COM
X-Gateway-Source-Info: USENET

In article <01HDC5HKFE4I8WWJFU@AXE.HUMBOLDT.EDU>, harrisc@jacks.humboldt.edu (Craig A. Harris) writes:
=Have written a utility on the VAX(VMS) to simulate a LPD transfer
=facility to our old CYBER mainframe which does not support LPD but 
=does have limited FTP features.  The software is functional for all
=print file types except for files created by the MAIL PRINT directive.
=
=The NAM$W_FID appears to be correct, however, NAM$W_DID is zero.

=The file_spec "_hsuvax$dua0:[]MAIL.LIS" also appears to be correct. 

Those files are known as "temporary files".  They're not entered in any
directory.

=The utility is written in FORTRAN using a USEROPEN function.  A status
=of RMS$_DNF (1C04A) is returned for these files.
=
=How does one access these files with a Directory ID of zero?

You:
	1)  Allocate and initialize a NAM block.
	2)  Use SYS$PARSE to set up the NAM block with a filespec including the
	    appropriate device.
	3)  Fill in the FID field with the FILE ID of the file.
	4)  Call SYS$OPEN.

Here's an example in C:

#include rms
long stat;
#define ckstat(x) if(((stat = x) & 7) != 1) SYS$EXIT(stat)

main(int nargs, char **args)
{	struct NAM my_nam;
	struct FAB my_fab;
	char esa[255];

	if (nargs != 5)
	{	puts("Usage: TEST filename fnum fseq frvn");
		SYS$EXIT(1);
	}
/* Initialize the FAB */
	my_fab = cc$rms_fab;
	my_fab.fab$l_fna = args[1];
	my_fab.fab$b_fns = strlen(args[1]);
	my_fab.fab$l_nam = &my_nam;
/* Note:  To open a file by FID, you've got to specify the FAB$M_NAM option */
	my_fab.fab$l_fop = FAB$M_NAM;
/* And the NAM block */
	my_nam = cc$rms_nam;
	my_nam.nam$l_esa = esa;
	my_nam.nam$b_ess = 255;
/* Use SYS$PARSE to set up the device information in the NAM block */
	ckstat(SYS$PARSE(&my_fab));
/* Fill in the NAM$W_FID field */
	my_nam.nam$w_fid[0] = atol(args[2]);
	my_nam.nam$w_fid[1] = atol(args[3]);
	my_nam.nam$w_fid[2] = atol(args[4]);
/* And open the file */
	ckstat(SYS$OPEN(&my_fab));
}
--------------------------------------------------------------------------------
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.

