Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26737 Discussions

recl value exceeds the maximum allowed for the file's record type

psing51
Beginner
445 Views

Hi All,

I am trying to run  a program compiled using intel fortran 17.0.5 20170817 compiler  on opensuse 12 having ~512 GB ram. The code -

user@machine1:~/STORE/TESTING/ssmis> cat test.f
       program main
       irecl= 538109432 
c      irecl= 2147483647
       open(3,file='obstore.data',form='unformatted',
     &   access='direct',recl=irecl)
       end

here is what i get when i compile & run this code -

user@machine1:~/OBSTORE/TESTING/ssmis> ifort test.f
user@machine1:~/OBSTORE/TESTING/ssmis> ./a.out
forrtl: severe (118): The 'RECL=' value in an OPEN statement for unit 3, file /home/user/STORE/TESTING/ssmis/obstore.data, exceeds the maximum allowed for the file's record type.
Image              PC                Routine            Line        Source
a.out              000000000042AA63  Unknown               Unknown  Unknown
a.out              0000000000408CBE  Unknown               Unknown  Unknown
a.out              00000000004029FE  Unknown               Unknown  Unknown
a.out              000000000040294E  Unknown               Unknown  Unknown
libc-2.22.so       00002B501C0D66E5  __libc_start_main     Unknown  Unknown
a.out              0000000000402869  Unknown               Unknown  Unknown
user@machine1:~/STORE/TESTING/ssmis>

In function, 

    open(3,file='obstore.data',form='unformatted', access='direct',recl=irecl)
If i set irecl to be 10x smaller (53810943) or , 

form = formatted, then code works fine.

  1. What is the "maximum/permissible/allowed"  value of irecl for unformatted file.
  2. Is there a compiler flag through which i can get past the "record length" limitation on unformatted file? 

I have already tried integer(kind=8)  for irecl, but the error message was same.

 Please let me know if more information is required from my end.

Eagerly awaiting your replies.

 

 

 

  

 

 

0 Kudos
1 Solution
Steve_Lionel
Black Belt Retired Employee
445 Views

Omit the rec=1 and stream access does exactly what you want. If you need to always overwrite the file, do a REWIND on the unit first. The maximum record length is 2**31-1, as documented under OPEN > RECL.

View solution in original post

7 Replies
jimdempseyatthecove
Black Belt
445 Views

Try:

user@machine1:~/STORE/TESTING/ssmis> cat test.f
       program main
       integer(8) :: irecl
c       irecl= 538109432_8 
      irecl= 2147483647_8
       open(3,file='obstore.data',form='unformatted',
     &   access='direct',recl=irecl)
       end

Jim Dempsey

Steve_Lionel
Black Belt Retired Employee
445 Views

I am going to guess that you really don't want direct access, but instead are trying to read data without record structure. Please use ACCESS='STREAM' for that.

psing51
Beginner
445 Views
as per jim's suggestion  - 
user@machine1:~/STORE/TESTING/ssmis> rm a.out
rm: remove regular file 'a.out'? y
user@machine1:~/STORE/TESTING/ssmis> cat test2.f
       program main
       integer(8) :: irecl
c       irecl= 538109432_8
      irecl= 2147483647_8
       open(3,file='STORE.data',form='unformatted',
     &   access='direct',recl=irecl)
       end
user@machine1:~/STORE/TESTING/ssmis> ifort test2.f
user@machine1:~/STORE/TESTING/ssmis> ./a.out
forrtl: severe (118): The 'RECL=' value in an OPEN statement for unit 3, file /home/user/STORE/TESTING/ssmis/STORE.data, exceeds the maximum allowed for the file's record type.
Image              PC                Routine            Line        Source
a.out              000000000042AA63  Unknown               Unknown  Unknown
a.out              0000000000408CBE  Unknown               Unknown  Unknown
a.out              00000000004029FE  Unknown               Unknown  Unknown
a.out              000000000040294E  Unknown               Unknown  Unknown
libc-2.22.so       00002B9A5E41C6E5  __libc_start_main     Unknown  Unknown
a.out              0000000000402869  Unknown               Unknown  Unknown
user@machine1:~/STORE/TESTING/ssmis>

 

 
as per Steve's suggestion - 
 
user@machine1:~/STORE/TESTING/ssmis> cat test3.f
       program main
       irecl= 538109432
c      irecl= 2147483647
       open(3,file='STORE.data',form='unformatted',
     &   access='stream',recl=irecl)
       end
user@machine1:~/STORE/TESTING/ssmis> ifort test3.f
user@machine1:~/STORE/TESTING/ssmis> ./a.out
forrtl: severe (112): RECL= specifier may not be applied to stream access file, unit 3, file /home/user/STORE/TESTING/ssmis/STORE.data
Image              PC                Routine            Line        Source
a.out              000000000042AA63  Unknown               Unknown  Unknown
a.out              0000000000408CBE  Unknown               Unknown  Unknown
a.out              00000000004029FE  Unknown               Unknown  Unknown
a.out              000000000040294E  Unknown               Unknown  Unknown
libc-2.22.so       00002ADBB9A7F6E5  __libc_start_main     Unknown  Unknown
a.out              0000000000402869  Unknown               Unknown  Unknown
user@machine1:~/STORE/TESTING/ssmis> vim test3.f
user@machine1:~/STORE/TESTING/ssmis> cat test3.f
       program main
       integer(8) :: irecl
       irecl=538109432
c       irecl= 538109432
c      irecl= 2147483647
       open(3,file='STORE.data',form='unformatted',
     &   access='stream',recl=irecl)
       end
user@machine1:~/STORE/TESTING/ssmis> ifort test3.f
user@machine1:~/STORE/TESTING/ssmis> ./a.out
forrtl: severe (112): RECL= specifier may not be applied to stream access file, unit 3, file /home/user/STORE/TESTING/ssmis/STORE.data
Image              PC                Routine            Line        Source
a.out              000000000042AA63  Unknown               Unknown  Unknown
a.out              0000000000408CBE  Unknown               Unknown  Unknown
a.out              00000000004029FE  Unknown               Unknown  Unknown
a.out              000000000040294E  Unknown               Unknown  Unknown
libc-2.22.so       00002B5E6CFA76E5  __libc_start_main     Unknown  Unknown
a.out              0000000000402869  Unknown               Unknown  Unknown
user@machine1:~/STORE/TESTING/ssmis>


 

I hope i correctly followed your suggestions.
mecej4
Black Belt
445 Views

From the Fortran 2003 Standard:

9.4.5.12 RECL= specifier in the OPEN statement:... This specifier shall not appear when a file is being connected for stream access.

Just remove the RECL clause from the OPEN statement for the stream file. Note Dave Cutler's derisive "Get a byteget a byteget a byte byte byte" .

psing51
Beginner
445 Views

I need to write data as - 

       write(3,rec=1)fixhdr,((LDC(i,j),j=1,kcol),i=1,nrow),
     &((RDC(i,j),j=1,kcol),i=1,nrow),((CDC(i,j),j=1,kcol),i=1,nrow),
     &((LUT(i,j),j=1,128),i=1,nrow),(data(i),i=1,ilength)

 

Which most likely would be incompatible with stream IO.
Is there no way of making the "direct" method work ?
 
Please let me know if there is an upper limit of irecl,
I will modify the code accordingly.
 
 
Steve_Lionel
Black Belt Retired Employee
446 Views

Omit the rec=1 and stream access does exactly what you want. If you need to always overwrite the file, do a REWIND on the unit first. The maximum record length is 2**31-1, as documented under OPEN > RECL.

View solution in original post

psing51
Beginner
445 Views

Thanks Steve, no runtime errors and i am able to write data. 

Now, Need to verify the content of the output file.

:)

Reply