LF Fortran 95

NAMELIST Statement


The NAMELIST statement specifies a list of variables that can be referred to by one name for the purpose of performing input/output.



NAMELIST /name/ group [[,] /name/ group] ...

name is the name of a namelist group.

group is a list of variable names.


A name in a group must not be the name of an array dummy argument with a non-constant bound, a variable with a non-constant character length, an automatic object, a pointer, a variable of a type that has an ultimate component that is a pointer, or an allocatable array.

If a name has the public attribute, no item in group can have the PRIVATE attribute.

The order in which the variables appear in a NAMELIST statement determines the order in which the variables' values will appear on output.



real :: a,b integer :: i,j namelist /input/ a,b,i,j open(10,file='data.dat') read(10,nml=input) write(*,nml=input) close(10) end   ! namelist data file &input b=12.3 i=4 a=13.2 j=12 /