FORTRAN 77 Language Reference

Output Actions

NAMELIST output uses a special form of WRITE statement, which makes a report that shows the group name. For each variable of the group, it shows the name and current value in memory. It formats each value according to the type of each variable, and writes the report so that NAMELIST input can read it.

The syntax of NAMELIST WRITE is:


WRITE ( extu,  namelist-specifier
 [, iostat] 
[, err]) 

where namelist-specifier has the form:


[NML=]group-name 

and group-name has been previously defined in a NAMELIST statement.

The NAMELIST WRITE statement writes values of all variables in the group, in the same order as in the NAMELIST statement.

Example: NAMELIST output:


demo% cat nam1.f 
* nam1.f Namelist output 
	CHARACTER*8 SAMPLE 
	LOGICAL*4 NEW 
	REAL*4 DELTA 
	NAMELIST /CASE/ SAMPLE, NEW, DELTA 
	DATA SAMPLE /'Demo'/, NEW /.TRUE./, DELTA /0.1/ 
	WRITE ( *, CASE ) 
	END 
demo% f77 nam1.f 
f77 nam1.f 
nam1.f: 
 MAIN: 
demo% a.out 
D&case sample= Demo , new= T, delta= 0.100000 
D&end 
demo%

Note that if you do omit the keyword NML then the unit parameter must be first, namelist-specifier must be second, and there must not be a format specifier.

The WRITE can have the form of the following example:


	WRITE ( UNIT=6, NML=CASE )