From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 24-JUN-1993 11:03:09.84
To:	EVERHART
CC:	
Subj:	Re: How do you get the XAB populated

X-Newsgroups: comp.os.vms
From: nreadwin@micrognosis.co.uk (Neil Readwin)
Subject: Re: How do you get the XAB populated
Message-Id: <C939E8.J4o@micrognosis.co.uk>
Sender: news@micrognosis.co.uk
Organization: Micrognosis, a division of CSK(UK) Ltd
Date: Wed, 23 Jun 1993 19:13:20 GMT
Lines: 50
To: Info-VAX@kl.sri.com
X-Gateway-Source-Info: USENET

fogelinc@pt.Cyanamid.COM (Carl Fogelin) writes:
|> The code below shows my current assumptions.  Note: I normally do return
|> status checking, but omitted it below as unnecessary for showing my delemma.

Don't omit the status checking. RMS would have told you that your
assumptions are wrong :-) Come to think of it, the LINKer would have told
you that your routine names are wrong. Anyway, the 'context' argument is
the "address of an internal FAB/NAM buffer". It does not return a FAB to
you, it returns a pointer to its own FAB. The following code works, but it
writes into that FAB (which is owned by the RTL). My guess is that this is
unsupported and I wouldn't use it myself. Neil.

#include <stdio.h>
#include <libdef.h>
#include <descrip.h>
#include <fab.h>
#include <xab.h>

struct FAB *context;
struct XABDAT dates;
int main()
{
   $DESCRIPTOR(ifile,"SYS$LOGIN:LOGIN.COM");
   struct dsc$descriptor_s oname;
   int status;

   oname.dsc$a_pointer = 0;  oname.dsc$w_length = 0;
   oname.dsc$b_class = DSC$K_CLASS_D;  oname.dsc$b_dtype = DSC$K_DTYPE_T;

   status = lib$find_file(&ifile,&oname,&context);      /* Got the FAB */
   dates = cc$rms_xabdat;
   context->fab$l_xab = &dates;
   status = sys$open(context);          /* does an implicit LIB$DISPLAY */

   {
   $DESCRIPTOR(ctlstr, "Created: !%D!/Expires !%D!/Revised!%D!/Backup !%D");
   char msgbuf[256]; long int msglen = 0;
   $DESCRIPTOR(outbuf, msgbuf);

   status = sys$fao(&ctlstr, &msglen, &outbuf, &dates.xab$q_cdt,
                &dates.xab$q_edt, &dates.xab$q_rdt, &dates.xab$q_bdt);
   msgbuf[msglen] = 0;
   printf(msgbuf);
   }
   status = sys$close(&context);
   status = lib$find_file_end(&context);
   }
-- 
 Phone: +44 71 815 5283  E-mail: nreadwin@micrognosis.co.uk
 Anything is a cause for sorrow that my mind or body has made

