(j3.2006) Seeming problem with NAMELIST output of charactervariables

Bill Long longb
Fri Oct 10 00:59:36 EDT 2014

On Oct 9, 2014, at 12:12 AM, Malcolm Cohen <malcolm at nag-j.co.jp> wrote:

>> So, in the default case (no DELIM specified in OPEN) we have the situation that 
>> namelist output of character data cannot be read by a namelist input statement. 
>> Which is an unexpected situation for many users.
>> Did we really intend that this be the case?
> Whether we really intended this, this is Fortran 90.  So approved 23 years ago 
> and unchanged since.  Even though we made other changes to namelist (we added 
> namelist comments).
> And obviously we DID intend this, indeed the text states it directly (originally 
> not as a consequence, that is a result in F2008 of text merges and 
> simplifications), and the NOTE is ample evidence we knew what we were doing. 
> Some might consider that decision mistaken, but that was the decision 
> nonetheless.

That?s fine - I was just checking if there was an oversight.  If it is intentional, the error we?re issuing is OK. 

>> At least one compiler (gfortran) ignores this combination of rules and includes 
>> the ? ? around character values in namelist output, which is what the user 
>> wanted/expected.
> If there is no OPEN statement for the file, or the user does not want to change 
> the behaviour of list-directed output, he can put DELIM='QUOTE' into his 
> namelist output statement.

I suggested adding this to the OPEN statement.  The specifier in the WRITE statement would seem the only option if the output were to an internal file..

> (oh, and this is not an "extension", it is giving the wrong answer; extensions 
> are when things are upwards compatible.)

I agree with this.  Some other compilers appear to do the right thing (no ? or ? around the output value) BUT do have an extension that allows that value to be read back in (some how deciding where the value begins and ends).  Either that or they ignore the problem with the input form without printing an error.  It would seem better to me to print a runtime error for the undelimited character value on input, and not leave the user to wonder what might have happened.


Bill Long                                                                       longb at cray.com
Fortran Technical Suport  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101

More information about the J3 mailing list