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

Output of long string is split into 2 records


I'm using this code:

         WRITE (LUPRN,*) Trim(ProblemTitle)

When Trim(ProblemTitle) is, say, 90 characters long, 2 records are output.

The first record is 80 characters, 2nd record is 10 characters.

Is this behaviour some hangover from the days of punched cards?

I'm puzzled!

0 Kudos
1 Reply
Black Belt Retired Employee

When you use list-directed output, you give up control over the formatting. In Intel Fortran, the default record length for list-directed output is 80 characters, so longer output gets split. The documentation tells you how to change this:

"There is a property of list-directed sequential WRITE statements called the right margin. If you do not specify RECL as an OPEN statement specifier or in environmental variable FORT_FMT_RECL, the right margin value defaults to 80. When RECL is specified, the right margin is set to the value of RECL. If the length of a list-directed sequential WRITE exceeds the value of the right margin value, the remaining characters will wrap to the next line. Therefore, writing 100 characters will produce two lines of output, and writing 180 characters will produce three lines of output. You can turn off the right margin using the wrap-margin compiler option or the FORT_FMT_NO_WRAP_MARGIN environment variable."

0 Kudos