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