7.3.1.3 Namelist Sequential WRITE Statement

The namelist sequential WRITE statement performs the following operations:

The namelist WRITE statement transfers as output the current values of all list entities associated with the specified namelist specifier. These values are written in a form that can be read as input by the namelist READ statement.

The order of data output is dictated by the sequence in which namelist entities are defined in a NAMELIST statement. The first list entity and its value are written first, the second list entity and its value are written second, and so on. Each value display begins on a new line.

Example

Consider a program segment with the following statements:

 CHARACTER*19 NAME(2)/2*'  '/
 REAL PITCH, ROLL, YAW, POSITION(3)
 LOGICAL DIAGNOSTICS
 INTEGER ITERATIONS
 NAMELIST /PARAM/ NAME, PITCH, ROLL, YAW, POSITION,
1         DIAGNOSTICS, ITERATIONS
  . . .
 READ (UNIT=1,NML=PARAM)
 WRITE (UNIT=2,NML=PARAM)

The input contains the following statements:

column 2
|
$PARAM
<TAB> NAME(2)(10:)='HEISENBERG',
<TAB> PITCH=5.0, YAW=0.0, ROLL=5.0,
<TAB> DIAGNOSTICS=.TRUE.
<TAB> ITERATIONS=10
$END

In this case, the WRITE statement writes the following:

$PARAM
NAME   = '                         ', '        HEISENBERG',
PITCH  =    5.000000    ,
ROLL   =    5.000000    ,
YAW    =   0.0000000E+00,
POSITION        = 3*0.0000000E+00,
DIAGNOSTICS     = T,
ITERATIONS      =                10
$END

Notice that character values are enclosed in apostrophes. The value of POSITION is not defined in the namelist input. It can be defined elsewhere in the program or be undefined. The namelist WRITE statement prints the current contents of POSITION.


Previous Page Next Page Table of Contents