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

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

psing51
New Contributor I
1,401 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
Honored Contributor III
1,401 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

0 Kudos
7 Replies
jimdempseyatthecove
Honored Contributor III
1,401 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

0 Kudos
Steve_Lionel
Honored Contributor III
1,401 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.

0 Kudos
psing51
New Contributor I
1,401 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.
0 Kudos
mecej4
Honored Contributor III
1,401 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" .

0 Kudos
psing51
New Contributor I
1,401 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.
 
 
0 Kudos
Steve_Lionel
Honored Contributor III
1,402 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.

0 Kudos
psing51
New Contributor I
1,400 Views

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

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

:)

0 Kudos
Reply