[J3] Question about the result of the SIZE= specifier in nonadvanced READ

Daniel Chen cdchen at ca.ibm.com
Wed Aug 13 18:02:04 UTC 2025


Hello all,

What should be the correct output from the following code?

```
    character(13) c
    real r1(3), r2(3)
    integer i1, i2

    c = '1.2, 1.2, 1.2'

    write (2, '(2a)') c, ' '

    write (3, '(2a)') c, ','

    rewind 2
    rewind 3

    read (2, '(3F5.1)', advance='no', size=i1) r1
print*, i1

    read (3, '(3F5.1)', advance='no', size=i2) r2
print*, i2


    end
```

The standard says the following about the SIZE= specifier
```
The SIZE= specifier in an input statement causes the variable specified to become defined with the count of

the characters transferred from the file by data edit descriptors during the input operation. Blanks inserted as

padding are not counted.

```

Different compiler gives different output. Some counts comma and some also counts blank.

What is the standard conforming output of this code?

Thanks,
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20250813/f6f46bc9/attachment.htm>


More information about the J3 mailing list