Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

OPEN RECL

jorgematheus
Débutant
1 523 Visites
Hi.
I'm trying to convert my old fortran 77 v3.31 to the
digital visual fortran explicyt

Everything is seem to be fine but i got this problem
with the new created files.

i have this code:

CHARACTER* 10 DESCR
REAL*4 R1,Z1,X1,X2,X3
OPEN(20,file='test.DAT',ACCESS='DIRECT',RECL=34)
DO 100 I = 1, 100
WRITE(20,REC=I)'ABCDEFGHIJ',1.0,2.0,3.0,4.0,5.0
100 CONTINUE
STOP
END

When i hexdum my old file a i see exactly 34 bytes per record. But in the new file i see 128 bytes. The additional space are filled with spaces.

It's seem recl is not working!. I had tried the explicit recordtype='FIXED' but the file i got is exactly the same.

Thank for your time
0 Compliments
6 Réponses
Steven_L_Intel1
Employé
1 523 Visites
In Digital/Compaq Fortran, the units for RECL of unformatted files is four bytes. If you're using a reasonably recent version of Visual Fortran (and if yours says "Digital", you're not), there's an option /assume:byterecl to change the unit to bytes.

Unfortunately, 34 isn't divisible by 4 so you can't take the easy approach of just dividing the RECL by 4.

Steve
0 Compliments
Jugoslav_Dujic
Précieux contributeur II
1 523 Visites
/assume:byterecl was available in DVF5 -- Project/Settings/Fortran/Fortran Data/Use bytes...

Jugoslav
0 Compliments
Steven_L_Intel1
Employé
1 523 Visites
Was it really? Good - I thought it came after that.

Steve
0 Compliments
Intel_C_Intel
Employé
1 523 Visites
It might have been related to Microsoft Powerstation
compatibility, where the record lengths were measured in
bytes. I seem to remember that if you opened an old
Powerstation project in DVF, it would use bytes. If
you started a new project, it would default to words.
At the time, I was selling a VB graphics postprocessor to a Fortran model, where the intermediate file was an unformatted direct access file, and this was one of the
things that would often cause trouble.
0 Compliments
jorgematheus
Débutant
1 523 Visites
Thank. Now everything is working fine.

I have a lot of small programs that need this setting, and i don't want to forget this setting in one of them because it will destroy my data. Can i preset the compiler to keep /assume:byterecl in all workspace??

Thank again
0 Compliments
Steven_L_Intel1
Employé
1 523 Visites
Actually, /assume:byterecl predates DVF and any concern about PowerStation. We added it for the benefit of our customers porting from other vendors UNIX systems to our compilers.

There is a way to save settings. Once you have a project set up the way you want it, click on the "Save Fortran Environment" button (a green tree). You can then give the saved settings a name. The next time you create a project of the same type (eg. console), it will ask you if you want to apply the saved settings.

Steve
0 Compliments
Répondre