home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / vms / 13002 < prev    next >
Encoding:
Internet Message Format  |  1992-07-31  |  3.0 KB

  1. Path: sparky!uunet!olivea!decwrl!pa.dec.com!e2big.mko.dec.com!quark.enet.dec.com!lionel
  2. From: lionel@quark.enet.dec.com (Steve Lionel)
  3. Newsgroups: comp.os.vms
  4. Subject: Re: FORTRAN OPEN on tape MOUNT/FOREIGN, bug or feature?
  5. Message-ID: <1992Jul31.135625.9829@e2big.mko.dec.com>
  6. Date: 31 Jul 92 13:56:25 GMT
  7. References: <id.95YR.OCD@ferranti.com>
  8. Sender: guest@e2big.mko.dec.com (Guest (DECnet))
  9. Reply-To: lionel@quark.enet.dec.com (Steve Lionel)
  10. Organization: Digital Equipment Corporation, Nashua NH
  11. Lines: 53
  12.  
  13.  
  14. In article <id.95YR.OCD@ferranti.com>, jlhall@ferranti.com 
  15. (Jonathan Luke Hall) writes:
  16. |>
  17. |>When using the OPEN statement from a FORTRAN program compiled and
  18. |>LINKed on a 6000-630 on VMS 5.5 accessing a file on a 3480 tape
  19. |>mounted using $MOUNT/FOREIGN, I notice that if I specify
  20. |>RECORDTYPE='FIXED' on the OPEN for write that I have to specify
  21. |>RECORDTYPE='VARIABLE' on the OPEN for read.
  22. |>
  23. |>There is no discrepancy between RECORDTYPEs if either the MOUNT is
  24. |>not FOREIGN and/or the RECORDTYPE is 'VARIABLE' on the write.
  25. |>
  26. |>It this a bug or a feature?
  27. |>-- 
  28.  
  29. Neither - I think it's a misunderstanding of the way foreign tapes work when
  30. you access them through language I/O (and hence RMS).  A foreign mounted tape
  31. has no "file structure" and is accessed at the block level.  Each tape block
  32. corresponds to one "record".  Tape marks indicate end-of-file on read, and
  33. you get a tape mark written when you close a file that was opened for WRITE.
  34. (And while I'm on the subject, the FORTRAN ENDFILE statement does not write
  35. tapemarks in VAX FORTRAN.)
  36.  
  37. If you open a foreign-mounted tape for write and specify RECORDTYPE='FIXED',
  38. each WRITE will write fixed-size blocks of whatever you specified as the
  39. RECL in length.  If the written record is "short", the record will be padded
  40. with blanks (if formatted) or nulls (if unformatted).  If you open the tape
  41. for read with RECORDTYPE='FIXED', the records (blocks) on the tape you read
  42. had better be exactly the RECL length or else you'll get an error.  I think
  43. that's what's happening to you.  If you use 'VARIABLE', then you can read
  44. arbitrary-length records (up to the size of RECL, if you specified it, or
  45. the RTL's defaults as documented in the VAX FORTRAN User Manual.)  On write,
  46. 'VARIABLE' writes out however much data was in your record, possibly giving
  47. you variable-sized blocks.
  48.  
  49. With non-foreign (ANSI labelled) tapes there is a file structure but the
  50. basic rules regarding fixed versus variable-length records still apply.
  51. Whether or not you'll get an error depends on the tape file's attributes
  52. and how they match up with what you said in the program, much like a disk
  53. file.  (The one difference being that the "longest record length" is not
  54. kept for tape files, so if you don't specify RECL for RECORDTYPE='VARIABLE'
  55. the RTL chooses a value based on the tape's blocksize.)
  56.  
  57. I hope this clarifies things for you - if not, feel free to send me mail.
  58.  
  59. --
  60.  
  61. Steve Lionel                    lionel@quark.enet.dec.com
  62. SDT Languages Group
  63. Digital Equipment Corporation
  64. 110 Spit Brook Road
  65. Nashua, NH 03062
  66.