Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!know!sdd.hp.com!ucsd!mvb.saic.com!dayton.saic.com!fac2 From: fac2@dayton.saic.com (Earle Ake) Newsgroups: comp.lang.fortran Subject: Re: VAX/VMS Fortran: Record length in BYTES Message-ID: <1990Dec18.154743.1388@dayton.saic.com> Date: 18 Dec 90 19:47:42 GMT References: <5125.2767b5c5@cc.curtin.edu.au> Organization: Science Applications Intl. Corp., Dayton, Ohio Lines: 49 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