[J3] What are the acceptable value separators for different Decimal= specifier?

Malcolm Cohen malcolm at nag-j.co.jp
Tue May 27 02:48:29 UTC 2025


Hi Daniel,

 

Historically, a great many compilers have simply used a blank (or
end-of-record) as a separator in list-directed output. There is rather less
uniformity for namelist output, but it is certainly common to use only
blanks.

 

Obviously (!) any output that uses the decimal symbol as a value separator
would be invalid.

 

The standard is very easy to read on this:

 

"With the exception of adjacent undelimited character sequences, the values
are separated by one or more blanks or by a comma, or a semicolon if the
decimal edit mode is COMMA, optionally preceded by one or more blanks and
optionally followed by one or more blanks."

 

I think that text says precisely what to do, and quite clearly.

 

Cheers,

-- 

..............Malcolm Cohen, NAG Oxford/Tokyo.

 

From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Daniel Chen via J3
Sent: Tuesday, May 27, 2025 10:12 AM
To: 'General J3 interest list' <j3 at mailman.j3-fortran.org>
Cc: Daniel Chen <cdchen at ca.ibm.com>
Subject: [J3] What are the acceptable value separators for different
Decimal= specifier?

 

Hello,
Consider the following code:
```
      real :: rlarr(5) = (/1.,2.,3.,4.,5./)

      character(80) :: buffer_comma(3)

      character(80) :: buffer_point(3)

      character(80) :: buffer_none(3)

 

      namelist /nml_r/ rlarr

 

      buffer_comma = (/"", "", ""/)

      write(buffer_comma,nml_r,decimal='comma')       ! Case Comma

      write(6,*) buffer_comma

 

      buffer_point = (/"", "", ""/)

      write(buffer_point,nml_r,decimal='point')       ! Case Point

      write(6,*) buffer_point

 

      buffer_none = (/"", "", ""/)

      write(buffer_none,nml_r)                        ! Case None

      write(6,*) buffer_none

      end
```

What are the acceptable outputs for the 3 different cases?

For Case Comma, I would think the only acceptable output is something like
the following with `;` as the value separator.
```
&NML_R  RLARR=1,000000000; 2,000000000; 3,000000000; 4,000000000;
5,000000000           /
```

For Case Point, I think the following should be good with `,` as value
separator
```
&NML_R  RLARR=1.000000000, 2.000000000, 3.000000000, 4.000000000,
5.000000000           /
```
But would a `blank` value separator also acceptable? It seems so as I
couldn't' find anywhere in the standard that disallows it.
```
&NML_R  RLARR=1.000000000 2.000000000 3.000000000 4.000000000 5.000000000
/
```

For Case None, the same question as Case Point.

Thanks,
Daniel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20250527/2e778a04/attachment.htm>


More information about the J3 mailing list