Gumley_LE@cc.curtin.edu.au (Liam Gumley) (12/13/90)
Re: VAX/VMS Fortran I have to write a series of data buffers to a file, each of which is 13730 bytes long. Note that this is not a multiple of four. The file I am creating MUST have a record length of 13730 bytes, and MUST only contain the data in the buffer i.e. no record length markers or terminators etc. - it is essentially an image file. So I cannot use an 'unformatted' type file, as these must have record lengths which are multiples of longwords - 13730 won't work in VAX/VMS Fortran. I can use write statements on a 'formatted' file, but the use of code such as byte buffer(13730) write(disk,10) buffer 10 format(13730a1) appears to slow down the write statement considerably. I have tried various hacks with internal writes, different file formats, but I always end up with something which is darned slow at writing. Can I do anything to speed up the writes to a 'formatted' file? Why doesn't VAX/VMS Fortran let you specify the record lengths in BYTES? Cheers, Liam. -- #Liam E. Gumley, Department of Applied Physics, Curtin University of Technology# #Perth, Western Australia. >>>All opinions expressed are exclusively mine.<<<#
seymour@milton.u.washington.edu (Richard Seymour) (12/14/90)
In article <5125.2767b5c5@cc.curtin.edu.au> Gumley_LE@cc.curtin.edu.au (Liam Gumley) writes: >Re: VAX/VMS Fortran > >I have to write a series of data buffers to a file, each of which is >13730 bytes long. Note that this is not a multiple of four. ...some background deleted... >So I cannot use an 'unformatted' type file, as these must have record lengths >which are multiples of longwords - 13730 won't work in VAX/VMS Fortran. ...slow example deleted... >Why doesn't VAX/VMS Fortran let you specify the record lengths in BYTES? it does -- simply specify FORM='FORMATTED' in the OPEN, and the RECL= turns into bytes instead of longwords. this is NOT ansi-standard, but it's been in VMS fortran since v3.5 (at least) for output speed, i recommend: byte array(13730) open(...,access='direct',form='formatted',recl=13730,recordtype='fixed') next=next+1 write(unit'next,1) array 1 format(13730a1) good luck, --dick
xxremak@csduts1.lerc.nasa.gov (David A. Remaklus) (12/18/90)
In article <5125.2767b5c5@cc.curtin.edu.au> Gumley_LE@cc.curtin.edu.au (Liam Gumley) writes: >Re: VAX/VMS Fortran > >I have to write a series of data buffers to a file, each of which is >13730 bytes long. Note that this is not a multiple of four. >The file I am creating MUST have a record length of 13730 bytes, and >MUST only contain the data in the buffer i.e. no record length markers >or terminators etc. - it is essentially an image file. >So I cannot use an 'unformatted' type file, as these must have record lengths >which are multiples of longwords - 13730 won't work in VAX/VMS Fortran. >I can use write statements on a 'formatted' file, but the use of code such as > (stuff deleted) If I read your description correctly, it sounds as though you are using fixed length records (this assumes that you ALWAYS right the 13730 bytes). I suggest you try using a fixed length direct access file. I'm not sure how VMS implements this but on all other systems that I have worked with, this method results in fast I/O and the equivant of a byte stream file (ie, no record headers and trailers). -- David A. Remaklus Currently at: NASA Lewis Research Center Amdahl Corporation MS 142-4 (216) 642-1044 Cleveland, Ohio 44135 (216) 433-5119 xxremak@csduts1.lerc.nasa.gov
fac2@dayton.saic.com (Earle Ake) (12/19/90)
In article <5125.2767b5c5@cc.curtin.edu.au>, Gumley_LE@cc.curtin.edu.au (Liam Gumley) writes: > Re: VAX/VMS Fortran > > I have to write a series of data buffers to a file, each of which is > 13730 bytes long. Note that this is not a multiple of four. > The file I am creating MUST have a record length of 13730 bytes, and > MUST only contain the data in the buffer i.e. no record length markers > or terminators etc. - it is essentially an image file. > So I cannot use an 'unformatted' type file, as these must have record lengths > which are multiples of longwords - 13730 won't work in VAX/VMS Fortran. > I can use write statements on a 'formatted' file, but the use of code such as > > byte buffer(13730) > write(disk,10) buffer > 10 format(13730a1) > > appears to slow down the write statement considerably. I have tried various > hacks with internal writes, different file formats, but I always end up with > something which is darned slow at writing. The best speed on write statements I have found is through unformatted fixed length records. Since you don't have a multiple of 4 the next best way is to use formatted fixed length records. Open your output file as fixed with a record size of 13730 (bytes). Use the equivalence statement and write out the entire array at once instead of with an implied do loop. This may speed things up for you. byte buffer(13730) character*13730 bigbuff equivalence (buffer(1), bigbuff) write(disk,10) bigbuff 10 format(a) Your first code example internally wrote a byte at a time 13730 times. The example I gave writes 13730 bytes once. > Can I do anything to speed up the writes to a 'formatted' file? > Why doesn't VAX/VMS Fortran let you specify the record lengths in BYTES? It's not FORTRAN per say but RMS that is giving you the heartburn. -- _____________________________________________________________________________ ____ ____ ___ Earle Ake /___ /___/ / / Science Applications International Corporation ____// / / /__ Dayton, Ohio ----------------------------------------------------------------------------- Internet: fac2@dayton.saic.com uucp: dayvb!fac2
gombo@tharr.UUCP (Alun Jones) (12/19/90)
I've got a different problem - but related - you might even say it's the opposite of your problem. I'm trying (valiantly) to translate from a VAX FORTRAN program onto a Unix system. I'm using AT&T's excellent freeware Fortran To C translator (it's free, and tech support is quick - bug fixes by return of Email, usually), and almost all of my problems come from the insistence of VMS Fortran to align some things, but not others. The program I'm converting uses a LOT of common blocks, with EQUIVALENCE statements, but that's not my problem - f2c copes with that and warns me when the COMMON alignment is screwy. That I don't mind. What is causing problems, though, is the use of files with a fixed record length. So far, I've just gone through and multiplied every RECL part of an OPEN statement by 4, and the program appears to work now. Is there any quick check I can apply to see which OPENs will require this treatment? Once again, thanks to AT&T for f2c - I'd recommend it to anybody who's trying to get Fortran working on several types of Unix platform. Hoping someone can help, Alun. ~~~~~ -- Alun Jones - Unix Development Engineer - Welcom Software Technology Int'l. My views are nothing whatsoever to do with the company I work for. (That may be boring, but I feel safer for it.) <-- tharr *free* public access to Usenet in the UK 0234 261804 -->
fac2@dayton.saic.com (Earle Ake) (12/23/90)
In article <1521@tharr.UUCP>, gombo@tharr.UUCP (Alun Jones) writes: [lines deleted] > What is causing problems, though, is the use of files with a fixed record > length. So far, I've just gone through and multiplied every RECL part of > an OPEN statement by 4, and the program appears to work now. Is there any > quick check I can apply to see which OPENs will require this treatment? From the book "Programming in VAX FORTRAN", chapter 13, the way VAX FORTRAN intreprets RECL on an open statement is such: "If the records are formatted, the length is the number of bytes." "If the records are unformatted, the length is the number of longwords." By default, files are opened as formatted unless otherwise specified. Multiply record lengths by 4 if there is a 'FORM=UNFORMATTED' parameter only. If the parameter looks like 'FORM=FORMATTED' or there is not a 'FORM=' parameter then the 'RECL' you have is in bytes. Hope this helps. Earle _____________________________________________________________________________ ____ ____ ___ Earle Ake /___ /___/ / / Science Applications International Corporation ____// / / /__ Dayton, Ohio ----------------------------------------------------------------------------- Internet: fac2@dayton.saic.com uucp: dayvb!fac2