home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / vms / 19768 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  2.0 KB

  1. Path: sparky!uunet!wupost!waikato.ac.nz!comp.vuw.ac.nz!zl2tnm!toyunix!don
  2. Newsgroups: comp.os.vms
  3. Subject: Re: Apending a file at the end of mail.
  4. Message-ID: <16209357@zl2tnm.gen.nz>
  5. From: don@zl2tnm.gen.nz (Don Stokes)
  6. Date: 23 Dec 92 10:28:22 GMT
  7. Sender: news@zl2tnm.gen.nz (GNEWS Version 2.0 news poster.)
  8. References: <1992Dec23.063743.3368@organpipe.uug.arizona.edu>
  9. Distribution: world,local
  10. Organization: The Wolery
  11. Lines: 46
  12.  
  13. vance@lpl.arizona.edu (Vance Haemmerle x4021) writes:
  14. >   And to think... TPU becomes the default editor under VMS V6.0.
  15. >   Oh the horror! ;-)
  16.  
  17. Not on my system.  (He says, despairing of finding enough space to put
  18. 5.4 up on....)
  19.  
  20. >   Anyway, here's someone's question I couldn't answer after spending
  21. >   lots of time with the DOC CD-ROM.  Is there a system service or
  22. >   Run-Time Library routine that returns the amount of blocks allocated
  23. >   to a file?  Something like stat() in C, but the allocated space, not
  24. >   the used space.  I hope the answer doesn't involve reading the
  25. >   directory file format manulally or seting up RMS control structures.
  26.  
  27. What's so hard about RMS control structures?
  28.  
  29.         .title get_hbk    Get highest block allocated to file
  30.     ;
  31.     ; allocated size = GET_HBK( filename string passed by descriptor )
  32.     ;
  33.         .psect HBK_RW, long,noexe,noshr,wrt
  34.     fab:    $FAB xab=xabfhc
  35.     xabfhc:    $XABFHC
  36.  
  37.         .psect HBK_RE, exe,shr,nowrt
  38.         .entry GET_HBK, ^M<>
  39.         movl 4(AP), R0            ; Find arg string
  40.         cvtwb (R0), fab+FAB$B_FNS    ; Poke size & address into FAB
  41.         movaq @4(R0), fab+FAB$L_FNA
  42.         $OPEN fab            ; Open file
  43.         blbc R0, 99$            ; OK?
  44.         $CLOSE fab            ; Close it again
  45.         movl xabfhc+XAB$L_HBK, R0    ; Grab highest block
  46.         ret
  47.  
  48.     99$:    $EXIT_S R0
  49.  
  50.         .end
  51.  
  52. (Yes, FAB$L_ALQ contains the same info, but I wanted to demonstrate just
  53. how easy XABs are.)
  54.  
  55. --
  56. Don Stokes, ZL2TNM (DS555)                        don@zl2tnm.gen.nz (home)
  57. Network Manager, Computing Services Centre            don@vuw.ac.nz (work)
  58. Victoria University of Wellington, New Zealand              +64-4-495-5052
  59.