Usenet comp.sys.vms (1990-2004)
 help / color / mirror / Atom feed
From: hoffman@xdelta.enet.dec.com (Stephen Hoffman)
Subject: Re: Trying to use SYS$ASSIGN...
Date: 1995/12/13	[thread overview]
Message-ID: <4an4al$ho0@nntpd.lkg.dec.com> (raw)
In-Reply-To: Pine.SOL.3.91.951210004347.22297A-100000@forbin.syr.edu


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
  ---------------------------------------------------------------------------




  reply	other threads:[~1995-12-13  5:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-12-10  5:00 Trying to use SYS$ASSIGN Carl J. Lambrecht
1995-12-13  5:00 ` Stephen Hoffman [this message]
1995-12-16  5:00   ` Pat Rankin
read-only archive

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