The NAMELIST @ statement defines a list of variables or array names, and associates it with a unique group name.
NAMELIST / grname / namelist [[,] / grname / namelist ] ...
Parameter |
Description |
grname |
Symbolic name of the group |
namelist |
List of variables and arrays |
The NAMELIST statement contains a group name and other items.
The group name is used in the namelist-directed I/O statement to identify the list of variables or arrays that are to be read or written. This name is used by namelist-directed I/O statements instead of an input/output list. The group name must be unique, and identifies a list whose items can be read or written.
A group of variables can be defined through several NAMELIST statements with the same group name. Together, these definitions are taken as defining one NAMELIST group.
The namelist items can be of any data type. The items in the namelist can be variables or arrays, and can appear in more than one namelist. Only the items specified in the namelist can be read or written in namelist-directed I/O, but it is not necessary to specify data in the input record for every item of the namelist.
The order of the items in the namelist controls the order in which the values are written in namelist-directed output. The items in the input record can be in any order.
Input data can assign values to the elements of arrays or to substrings of strings that appear in a namelist.
The following constructs cannot appear in a NAMELIST statement:
Constants (parameters)
Array elements
Records and record fields
Character substrings
Dummy assumed-size arrays
Example: The NAMELIST statement:
CHARACTER*16 SAMPLE LOGICAL*4 NEW REAL*4 DELTA NAMELIST /CASE/ SAMPLE, NEW, DELTA
In this example, the group CASE has three variables: SAMPLE, NEW, and DELTA.