Usenet comp.sys.vms (1990-2004)
 help / color / mirror / Atom feed
* Trying to use SYS$ASSIGN...
@ 1995-12-10  5:00 Carl J. Lambrecht
  1995-12-13  5:00 ` Stephen Hoffman
  0 siblings, 1 reply; 3+ messages in thread
From: Carl J. Lambrecht @ 1995-12-10  5:00 UTC (permalink / raw)



Over the course of a client/server project I've been working on, I've 
posted to these two newsgroups with a couple of questions.  I have one 
more, hopefully final, problem to resolve.  The VAX server uses Multinet 
for configuring the different server daemons (FTP, etc.), but I'm having 
problems getting my server process to make a network connection through a 
VMS channel when started by the MultiNet server.  The bit of code which 
appears to be having a problem is the following:

unsigned short gsock_in;
int Status;
static struct {int Size; char *Ptr;} Descr={9,"SYS$INPUT"};

Status = SYS$ASSIGN(&Descr, &gsock_in, 0, 0);
if (!(Status&1)) {
	exit(Status);
}

This bit of code seems to consistently give the error of "no device or 
address".  It doesn't appear to be a problem with the way I am set up in 
Multinet, but I still can't get it to work.  Is there anything I should 
look for in the system logical or symbol tables in order to get this to 
work?  If you have done something of this nature, please get in touch 
with me at either this e-mail address or, preferably: 
	clambrecht@kinesisinc.com 
Thank you in advance!

-Carl Lambrecht
Kinesis Computing, Inc. 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Trying to use SYS$ASSIGN...
  1995-12-10  5:00 Trying to use SYS$ASSIGN Carl J. Lambrecht
@ 1995-12-13  5:00 ` Stephen Hoffman
  1995-12-16  5:00   ` Pat Rankin
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hoffman @ 1995-12-13  5:00 UTC (permalink / raw)



In article <Pine.SOL.3.91.951210004347.22297A-100000@forbin.syr.edu>, "Carl J. Lambrecht" <cjlambre@mailbox.syr.edu> writes:
..
:The bit of code which appears to be having a problem is the following:
:
:unsigned short gsock_in;
:int Status;
:static struct {int Size; char *Ptr;} Descr={9,"SYS$INPUT"};
:
:Status = SYS$ASSIGN(&Descr, &gsock_in, 0, 0);
:if (!(Status&1)) {
:	exit(Status);
:}
:
:This bit of code seems to consistently give the error of "no device or 
:address"...

  You will want to take a look at the C documentation around the
  declaration and use of the string descriptor structure.  I've
  added a colon to the device, I've switched to the $DESCRIPTOR
  macro (use of the dsc$descriptor structure would have worked),
  I've changed to the correct case -- lowercase -- for the call
  to the sys$assign() routine, I've added a few include files, and
  I've switched over to the status check macro $VMS_STATUS_SUCCESS.
  I've also changed a few variable names to reflect their use...

	--

  #include <descrip.h>
  #include <starlet.h>
  #include <stsdef.h>

  unsigned short int InputChan;
  int Status;
  $DESCRIPTOR( InputDevDescr, "SYS$INPUT:" );

  Status = sys$assign( &InputDevDescr, &InputChan, 0, 0);
  if (!$VMS_STATUS_SUCCESS( Status ))
      return Status;

	--

  If you choose to use a string descriptor and are manually
  initializing it, you will want to use the descriptor class
  DSC$K_CLASS_S until you fully understand the declaration and
  use of the dynamic string descriptor class DSC$K_CLASS_D. 
  And most common string descriptors use the text string data
  type: DSC$K_DTYPE_T.  (These values, and the structure of
  various string descriptors are declared in descrip.h.)

	--

  I strongly recommend taking a look at the DEC C manuals, as they
  cover various topics related to the use of DEC C on OpenVMS.  (If
  you are still using VAX C, seriously consider upgrading to DEC C.)


  ------------------------------ Opinionative -------------------------------
   Stephen Hoffman      OpenVMS Engineering      hoffman@xdelta.enet.dec.com
                 Insunt interdum menda in eo quod est efficax
  ---------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Trying to use SYS$ASSIGN...
  1995-12-13  5:00 ` Stephen Hoffman
@ 1995-12-16  5:00   ` Pat Rankin
  0 siblings, 0 replies; 3+ messages in thread
From: Pat Rankin @ 1995-12-16  5:00 UTC (permalink / raw)


In article <4an4al$ho0@nntpd.lkg.dec.com>,\
 hoffman@xdelta.enet.dec.com (Stephen Hoffman) writes...
[...]
>:static struct {int Size; char *Ptr;} Descr={9,"SYS$INPUT"};
[...]
>  You will want to take a look at the C documentation around the
>  declaration and use of the string descriptor structure.
[...]
>  If you choose to use a string descriptor and are manually
>  initializing it, you will want to use the descriptor class
>  DSC$K_CLASS_S until you fully understand the declaration and
>  use of the dynamic string descriptor class DSC$K_CLASS_D. 
>  And most common string descriptors use the text string data
>  type: DSC$K_DTYPE_T.  (These values, and the structure of
>  various string descriptors are declared in descrip.h.)

     The descriptor he is using is not the source of his problem,
because is it completely correct (as long as `int' and `char *' are
each 32 bits, and assuming that the length value fits within 16 bits,
so as not to overflow into the type & class fields).  Probably 98%
of VAX/VMS assembler code--including within VMS itself--would have
constructed a similar descriptor without bothering with the type
and class.

     System services do not even examine the type and class fields.
Even if they did, 0 is a valid value (indicating "unspecified", which
is treated as static for the class and arbitrary bytes for the type).
His descriptor did have zeroes in those two fields due to the bit
pattern of the length value 9.

     Neither adding a trailing colon to "SYS$INPUT" nor changing
the case of "SYS$ASSIGN" makes any difference.  Almost certainly the
original problem was due to his actual translation of "SYS$INPUT",
not to the code which was posted.

		Pat Rankin, rankin@eql.caltech.edu



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1995-12-16  5:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-12-10  5:00 Trying to use SYS$ASSIGN Carl J. Lambrecht
1995-12-13  5:00 ` Stephen Hoffman
1995-12-16  5:00   ` Pat Rankin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox