[mod.computers.vax] Creating Logical Names from VAX C

m1b@rayssd.ray.COM.UUCP (04/09/87)

I am trying to create a logical name in my process table from within
a C program.  I am using SYS$CRELNM.  SYS$CRELOG is obsolete so I don't
want to use that.  LIB$SET_LOGICAL works fine but I want to know what I
am doing wrong.  I am running VMS V4.4 using C V2.2.  Here is a sample
program that does not produce the logical name NEWNAME.  Strangely
enough, it exits with SS$_NORMAL.  Can someone who has successfully
used this system service help me out?  Thanks.

---- Snip here ----
#include	descrip
#include	lnmdef
#include	psldef
#define	MAXLEN	100

main()
{
	extern	unsigned long	sys$crelnm();

	unsigned char	acmode = PSL$C_USER;
	unsigned long	attr = 0;
	long	status;
	char	defname[MAXLEN];
	char	logname[MAXLEN];

	struct	{
		struct
		{
			short	len;
			short	code;
			long	*baddr;
			long	*rladdr;
		} log;
		long	eos;
	} loglst = {
		{ MAXLEN, LNM$_STRING, defname, 0}, 0 };

	$DESCRIPTOR(LOGNAME,logname);
	$DESCRIPTOR(TABLE_NAME, "LNM$PROCESS_TABLE");

	strcpy(defname, "abc.xyz");
	strcpy(logname, "NEWNAME");
	TABLE_NAME.dsc$w_length = strlen("LNM$PROCESS_TABLE");
	loglst.log.len = strlen(defname);
	LOGNAME.dsc$w_length = strlen(logname);
	status = sys$crelnm(&attr, &TABLE_NAME, &LOGNAME, &acmode, &loglst);
	exit(status);
}

Joe Barone ---------------------------> m1b@rayssd.RAY.COM
{cbosgd, gatech, ihnp4, linus, mirror, uiucdcs}!rayssd!m1b