Path: utzoo!attcan!uunet!crdgw1!rpi!julius.cs.uiuc.edu!apple!bionet!ames!skipper!elxsi!maine From: maine@elxsi.dfrf.nasa.gov (Richard Maine) Newsgroups: comp.lang.fortran Subject: Re: record length for direct access files Message-ID: Date: 26 Sep 90 16:58:26 GMT References: <2146@key.COM> Sender: news@skipper.dfrf.nasa.gov Organization: NASA Dryden, Edwards, Cal. Lines: 79 In-reply-to: sjc@key.COM's message of 25 Sep 90 18:10:44 GMT In article , mccalpin@perelandra.cms.udel.edu (John D. McCalpin) writes: John> Silicon Graphics revised the behavior of their Fortran compiler for John> direct access files in release 3.2 of their O/S to define the record John> length (RECL=NNN) in words rather than bytes. In explanation, the John> release notes state: John> John> "The ANSI standard states that the specified record lengths John> for unformatted direct access files must imply the number of John> words." John> John> Since I have observed a variety of behaviors for this particular John> issue, I decided to look it up in the new standard. John> John> From the Fortran-90 draft S8, version 112, section 9.3.4.5, discussing John> the RECL= parameter to the OPEN statment: John> John> "If the file is being connected for unformatted input/output, John> the length is measured in processor-dependent units." John> John> AAAAARRRRRRGGGGGGHHHHHH! John> John> Is this in the current draft? On 25 Sep 90 18:10:44 GMT, sjc@key.COM (Steve Correll) said: Steve> The S8.115 (June 90) draft section 9.3.4.5 page 9-8 says Steve> "processor-dependent units". But so does the X3.9-1978 (Fortran Steve> 77) standard page 12-26. The folks at SGI should read more Steve> carefully. Yep. Sounds to me like the SGI folk meant the "ANSI standard" in the sense that if that's the way the Vax compiler works, it must be standard. :-) Actually, I'd think the Vax way would be a poor choice for a Unix environment where there is no need to restrict the record length to necessarily being a multiple of the "word" length. But that's one of those quality of implementation issues; the standard clearly allows either choice. Steve> If the committee prefers not to define a construct which Steve> Fortran 77 left explicitly undefined, perhaps they could add a Steve> new RECSIZE= clause which is defined to use the same units as a Steve> new SIZEOF intrinsic, and put RECL= in their small typeface. Steve> They could still let the processor decide what those units are. See the IOLENGTH specifier in the INQUIRE statement. Section 9.6.3 in the S8.115 draft. A little on the awkward side for my taste, but it does achieve the desired purpose. The result from the IOLENGTH specifier is defined to be suitable for RECL. Sample use: type my_type ...lots of obscure stuff end type type(my_type) :: my_variable integer :: record_length, iostat !--- And another variable to throw in, just to clarify that !--- we can have a general io-list, not restricted to a single item. integer :: key .... inquire(iolength=record_length) key, my_variable open (10,file='myfile',form='unformatted', & access='direct', recl=record_length, & status='new',action='readwrite',iostat=iostat) if (iostat /= 0) ....whatever... write(10,rec=1,iostat=iostat) key, my_variable .... -- Richard Maine maine@elxsi.dfrf.nasa.gov [130.134.64.6]