Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
3 Views

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
Highlighted
Black Belt
3 Views

When you use list-directed

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."

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos