Article 128027 of comp.os.vms:
Path: nntpd.lkg.dec.com!pa.dec.com!decwrl!enews.sgi.com!lll-winken.llnl.gov!uwm.edu!homer.alpha.net!mvb.saic.com!info-vax
From: Arne Vajhoej <ARNE@ko.hhs.dk>
Newsgroups: comp.os.vms
Subject: Re: Finding file size from DEC Fortran
Message-ID: <01HUKQ0EXJ828WW1D1@kopc.hhs.dk>
Date: Sun, 27 Aug 1995 17:09:57 +0100
Organization: Info-Vax<==>Comp.Os.Vms Gateway
X-Gateway-Source-Info: Mailing List
Lines: 46

> A couple of eons ago, I found it very handy to use a FORTRAN open and
> then various RMS functions (SYS$GET, SYS$PUT, ...) for the actual I/O.
> The performance increase in my case was impressive, and thanks to
> FOR$RAB, the programming effort was pretty low.  All those RABs, FABs,
> XABs, NAMs, et c. are nice to avoid whenever possible.  Imagine my
> disappointment when I learned that there was no easy way to do the same
> thing in C.

The following is undocumented/unsupported, but works fine for VAX C:

#include <stdio.h>
#include <string.h>
#include <rab.h>
#include <fab.h>
#include <nam.h>
/* must be linked with VAXCRTL.OLB and not VAXCRTL.EXE */
extern int _fstat(int, struct FAB **, struct NAM **, struct RAB **);

int sys$put();

main()
{
   int i,stat;
   char s[]="This is a test";
   FILE *fp;
   struct FAB *fabptr;
   struct RAB *rabptr;
   struct NAM *namptr;
   fp=fopen("z.z","w");
   _fstat(fileno(fp),&fabptr,&namptr,&rabptr);
   rabptr->rab$l_rbf=s;
   rabptr->rab$w_rsz=strlen(s);
   for(i=0;i<10;i++) stat=sys$put(rabptr,0,0);
   fclose(fp);
}

DEC C do have a decc$_fstat, but it appears not to work like VAXCRTL _fstat !
(well - that is what to expect from undocumented/unsupported features)

                                                          Arne

Arne Vajhøj                             local DECNET:  KO::ARNE
Computer Department                     PSI:           PSI%238310013040::ARNE
Southern Denmark Business School        Internet:      ARNE@KO.HHS.DK
                WWW URL: http://www.hhs.dk/~arne/arne.html



