On 4/26/2018 8:57 AM, Jaromir Jakacki wrote:
> Thank you for replay,
> the main point is that my colleague made mistake and have calculated
> wrong record length (calculated record length correctly, but did not use
> '-assume byterecl' flag). Then wrote data without the flag. I would like
> to fix it using record length based on bytes. For example for real*8
> array with 10 elements:
> 1) his record length (SRL) is 10*8*4 = 320
> 2) based on bytes record length (DRL) should be 10*8=80
> How can i read data based on SRL and write is based on DRL.
> I tried to read it using recl=320 but it does not work (it saves data,
> but i am not able to read it using different sofware).
> On 26/04/2018 13:56, arrl wrote:
>> On 4/26/2018 4:56 AM, Jaromir Jakacki wrote:
>>> I have data that has been written using one record length and would
>>> like to read them and then write using another record length (fortran
>>> direct access). I use Intel compiler that use default length unit is
>>> 4 bytes word. But i am able to use compiler flat '-assume byterecl'
>>> and in this case the record length will be 4bytes*2 (for double
>>> precision). Is it possible to use both record lengths in one fortran
>>> Thank you in advance for your help
>>> with best regards,
>> As you pointed out, -assume byterecl is one of the options ifort
>> requires for Fortran standard compliance. I'm not certain whether this
>> is the primary point of your question.
>> If you are copying a direct access file, OPENing separate UNITs should
>> permit you to specify RECL individually. If you are changing all data
>> items to double their width, and you wish the new file to contain the
>> same number of records, the new RECL would be twice the old one.
>> I don't know why you bring up the number of bytes of storage of an
>> individual datum. Unless the old file was written with, for example,
>> RECL=4, the normal situation would be a RECL of at least 132.
>> I'm not certain that Intel specifies a default value of RECL. In
>> general, the old file would require reading by the same compiler with
>> the same RECL used when it was written.
I found this in ifort doc:
Default Record Lengths (RECL)
RECORDTYPE RECL value
'FIXED' None; value must be explicitly specified.
All other settings 132 bytes for formatted records; 510 longwords for
1To change the default record length values, you can use environment
variable FORT_FMT_RECL or
Of course, if you always set RECL before opening a file for read or
write, this won't be relevant.
It seems reasonable to expect that a file written without byterecl will
be the same as with byterecl and RECL set 4 times the size, but this
isn't specified anywhere, and is outside the scope of Fortran90.