home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / vms / 20667 < prev    next >
Encoding:
Text File  |  1993-01-09  |  2.2 KB  |  58 lines

  1. Path: sparky!uunet!cis.ohio-state.edu!ucbvax!EQL.CALTECH.EDU!rankin
  2. From: rankin@EQL.CALTECH.EDU (Pat Rankin)
  3. Newsgroups: comp.os.vms
  4. Subject: Re: RMS RAB & FAB for VAXC file
  5. Message-ID: <930108192613.21c047c4@EQL.Caltech.Edu>
  6. Date: 9 Jan 93 03:27:25 GMT
  7. Sender: usenet@ucbvax.BERKELEY.EDU
  8. Organization: The Internet
  9. Lines: 47
  10.  
  11. >>Coming back from my Christmas I have read a long discussion about VAX C
  12. >>buffer flushing. Many people say that it is easy to get the RAB/FABs from
  13. >>a VAX C FILE *
  14. >>
  15. >>OK so how do you do it ???
  16.  
  17.      It has been discussed here several times over the years.  However
  18. said it was "easy" has mislead you, because it's an invitation to future
  19. problems.
  20.  
  21. > Sorry, that was a mistake on my part.  I was confusing two RTLs.  From
  22. > the FORTRAN RTL, you can get the RAB from the LUN via the (undocumented,
  23. > last time I checked) routine FOR$RAB.  There's no such routine (at least
  24. > under VMS v5.4-2 in the VAXC RTL), though Ehud had indicated that a
  25. > perusal of the listings will allow you to figure out how to find it.
  26.  
  27.      FOR$RAB is discussed briefly in the section of the FORTRAN manual
  28. (User's Guide) dealing with USEROPEN routines.  So, I wouldn't classify
  29. it as undocumented.
  30.  
  31.      The routine for accessing VAXCRTL's RMS structures is undocumented
  32. and intended to be private to the library.  If you link against the
  33. shareable image version of VAXCRTL you won't be able to use it at all.
  34. If you link with the object library, you will--until you try to move
  35. to DEC C and DECC$SHR that is.
  36.  
  37. #include <stdio.h>
  38. #include <rms.h>
  39.     /* _fstat() is a private routine internal to VAXCRTL */
  40. extern int _fstat(int, struct FAB **, struct NAM **, struct RAB **);
  41. ...
  42.     FILE *fp = fopen(...);
  43.     struct FAB *fab_p;
  44.     struct NAM *nam_p;
  45.     struct RAB *rab_p;
  46.     int result = _fstat(fileno(fp), &fab_p, &nam_p, &rab_p);
  47.     if ( result >= 0 ) {
  48.     /* do something with one or more of the RMS blocks */
  49.     }
  50.  
  51.      It's also possible to derive a RAB pointer by doing some magic
  52. arithmetic on a FILE pointer, but that goes beyond undocumented and
  53. unsupported to _unsupportable_.  I'd advise against doing that or using
  54. _fstat().  If you want access to RMS, then use RMS.
  55.  
  56.         Pat Rankin, rankin@eql.caltech.edu
  57.  
  58.