Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Maximum line length for WRITE statement

RalfS
Beginner
6,381 Views

Hi all, I'm running in an error:

"forrtl: severe (66): output statement overflows record"

ifort - v says I'm running "Intel(R) 64, Version 17.0.2.187 Build 20170213" in MS Studio Community 2015

I am writing a very long line to a file with 1007 columns, the following statement gives the error

WRITE(16,'(2G13.3, 2I3, 2G10.2, I4, 1200(1X,G15.8,1X,E12.6))')
     & X, Y, N, IH, ZT, ZB, NH,  ( PROP(M), FLAG(M) , M=1, SIZE(PROP) )    

Note:
-statement simplified for this post
-unit 16 is well defined
-the value of '1200' in the format is always larger than SIZE(PROP)

I changed the code to first do an internal write to "out_test", where this variable has a large enough size:

CHARACTER(35000) :: out_test

so instead of the above, I do

WRITE(out_test,  <SAME FORMAT ETC.>

this works until I try to write it to a file:

WRITE(16,'(A)') trim(out_test)

Again same error.

this however works (but contains line breaks in the output I want to avoid):

WRITE(16,*) trim(out_test)

Any hints?

Cheers

-Ralf

 

0 Kudos
4 Replies
andrew_4619
Honored Contributor III
6,382 Views

The default record  length for the file is not long enough I think. Add a RECL= to the open statement.

 

0 Kudos
Steve_Lionel
Honored Contributor III
6,382 Views

Show us the OPEN statement for unit 16. The documented maximum record length for a formatted, variable-length record is 2147483640 bytes. As far as I know, you should not need to specify RECL. Can you post a small but complete program that shows the problem?

0 Kudos
andrew_4619
Honored Contributor III
6,382 Views

really confused now. I thought there was some problem with records over 132 characters as I have had problems in the past. I can even look at code where i have added record lengths as a fix. Try as I might I cannot replicate this problem. Maybe with some other /older compiler perhaps ......

0 Kudos
RalfS
Beginner
6,382 Views

Thanks Andrew and Steve,

indeed it was the OPEN statement:

 OPEN(16,FILE=OUTF,STATUS='UNKNOWN',RECL=8192)

which I changed to

 OPEN(16,FILE=OUTF,STATUS='UNKNOWN')

This worked.

 

Cheers

-Ralf

 

0 Kudos
Reply