[comp.lang.fortran] HP-UX f77 namelist problems

schell@iris.ucdavis.edu (Stephan Schell) (06/14/89)

I have a problem using namelists on Hewlett-Packard's 9000/825 under HP-UX
3.0 that I have not encountered on other machines (e.g., VAXen).

HP-UX 3.0 (9000/825 machine) version of f77 does not seem to accept namelist
input like (I think) it should.  I have a real array in the namelist.  If I
do not specify each and every element's value in the namelist input file,
then I get a nasty error message.  If I do specify every element's value,
then all is well.

The HP-UX f77 manual seems to indicate that what I'm doing should be OK.  
I don't think the user of the program should be responsible for filling 
up array elements that he does not want to use.

OS release and version info: HP-UX A.B3.10 B
Here is file "test.f".  Typing "f77 -a -K -o test test.f" produces 
no warnings. (check for anything that is non-ANSI according to HP).
        PROGRAM TEST
        CHARACTER*16 A(3)
        REAL        B(3), C(3), D(3)
        NAMELIST /FOO/ A, B, C, D

        OPEN(UNIT=10,FILE='TEST.INP',ACCESS='SEQUENTIAL',STATUS='OLD',
     1                FORM='FORMATTED')

        READ(UNIT=10,NML=FOO)
        CLOSE(UNIT=10)

        STOP
        END

Here is file "TEST.INP".  Notice that only the first element of each array
is given a value.

 $FOO
 A	= 'AZ',
 B	= 0.0,
 C	= 360.0,
 D	= 0.1
 $END

Here is the result of typing "test".  
*** FORTRAN I/O ERROR 907: ERROR IN LIST-DIRECTED I/O READ OF CHARACTER DATA
( 0)  0x00007128   IO_DED + 0x250
( 1)  0x00004d14   FTN_F_RSNE + 0x154
( 2)  0x00002ed0   test + 0x128

So, what did I do wrong, or have I found a bug, or are the namelist standards
too vague to make a determination here?

Thanks for anything you have to say.

Stephan V. Schell
Dept. of Electrical Engineering
University of California, Davis
schell@iris.ucdavis.edu
...ucbvax!ucdavis!iris!schell

khb@chiba.Sun.COM (Keith Bierman - SPD Languages Marketing -- MTS) (06/14/89)

In article <4654@ucdavis.ucdavis.edu> schell@iris.ucdavis.edu (Stephan Schell) writes:
>I have a problem using namelists on Hewlett-Packard's 9000/825 under HP-UX
>3.0 that I have not encountered on other machines (e.g., VAXen). ...
>
>OS release and version info: HP-UX A.B3.10 B
>Here is file "test.f".  Typing "f77 -a -K -o test test.f" produces 
>no warnings. (check for anything that is non-ANSI according to HP).

Well, NAMELIST is not in x3.9-1978 (aka fortran 77) so file a bug
against the non-ansi detection :>
>
>Here is the result of typing "test".  
>*** FORTRAN I/O ERROR 907: ERROR IN LIST-DIRECTED I/O READ OF CHARACTER DATA
>( 0)  0x00007128   IO_DED + 0x250
>( 1)  0x00004d14   FTN_F_RSNE + 0x154
>( 2)  0x00002ed0   test + 0x128
>
>So, what did I do wrong, or have I found a bug, or are the namelist standards
>too vague to make a determination here?

There is no NAMELIST in the "old" standard. so anything a vendor does
is "ok". Your code happens to run on any sensible namelist
implementation (vax, sun, lahey, univac for starters). So I would file
a bug report.


Keith H. Bierman      |*My thoughts are my own. Only my work belongs to Sun*
It's Not My Fault     |	Marketing Technical Specialist    ! kbierman@sun.com
I Voted for Bill &    |   Languages and Performance Tools. 
Opus  (* strange as it may seem, I do more engineering now     *)

milburn@me10.lbl.gov (John Milburn) (06/14/89)

In article <4654@ucdavis.ucdavis.edu> schell@iris.ucdavis.edu (Stephan Schell) writes:
>I have a problem using namelists on Hewlett-Packard's 9000/825 under HP-UX
>3.0 that I have not encountered on other machines (e.g., VAXen).
>
>HP-UX 3.0 (9000/825 machine) version of f77 does not seem to accept namelist
>input like (I think) it should.  I have a real array in the namelist.  If I
[...]
> $FOO
> A	= 'AZ',
> B	= 0.0,
> C	= 360.0,
> D	= 0.1
> $END
>

I had the same problem, until I realized that the hp-ux namelist, unlike
VAX/VMS namelist, would like you to give it " &" as a record delimiter,
rather than "$". Since then, have had no trouble.
 __________________________________________________________________________
| John Milburn - Advanced Light Source - Lawrence Berkeley Laboratory      |
| INTERNET:   JEMilburn@lbl.gov   BITNET:    JEMilburn@LBL.bitnet          |
| DECNet:     LBL::JEMilburn      UUCP:      {...}!ucbvax!lbl.gov!JEMilburn|
| Ma Bell:    (415) 486-6969      SnailMail: 1 Cyclotron Road 46-161       |
| Facsimile:  (415) 486-4873                 Berkeley, Ca. 94720           |
 --------------------------------------------------------------------------

cdb@hpclcdb.HP.COM (Carl Burch) (06/25/89)

> Well, NAMELIST is not in x3.9-1978 (aka fortran 77) so file a bug
> against the non-ansi detection :>

I hate it when the competition's right. :-)  Keith's correct, the
non-ANSI detection was left off the NAMELIST implementation by accident.

On the original run-time problem, it will go away if you remove the
white space around the '=' (i.e., "C=360.0," instead of "C = 360.0,").  As
often happens, the fix for another problem caused this one - we forgot to
allow whitespace (tabs, spaces) after the variable name that terminates the
proceding array list.

I suspect the compiler team will correct both of these problems for the
next release, now that they have been pointed out.  By the way, both '$' and
'&' delimiters for namelist data should be accepted (they are on this example).
If you can find an example where one will work and not the other, please e-mail
me.
							- Carl Burch