# 4.11 NAMELIST Statement

The NAMELIST statement defines a list of variables or array names and associates that list with a unique group-name. The group-name is used in the namelist I/O statement to identify the variables or arrays that are to be read or written.

A NAMELIST statement takes the following form:

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

group-name
  Is a symbolic name.
namelist
  Is a list of variable or array names (separated by commas) that are to be associated with the preceding group-name.

Rules and Behavior

The namelist associates a group of entities (variables or arrays) with a single group-name, which is used by namelist I/O statements instead of an I/O list. The unique group-name identifies a list whose entities can be modified or transferred.

You cannot include array elements, character substrings, pointers, records, and record fields in a namelist, but you can use namelist I/O to assign values to elements of arrays or substrings of character variables that appear in namelists. Dummy arguments can appear in a namelist.

The namelist entities can have any data type (which can be given explicitly or implicitly).

Only the entities specified in the namelist can be read or written in namelist I/O. It is not necessary for the input records in a namelist input statement to define every entity in the associated namelist.

The order of entities in the namelist controls the order in which the values are written in the namelist output. Input of namelist values can be in any order.

A variable or an array name can appear in several namelists.

Example

In the following example, the NAMELIST statement defines two group- names: INPUT, with the entities NAME, GRADE, and DATE; and OUTPUT, with the entities TOTAL and NAME.

    CHARACTER*30 NAME(25)

    NAMELIST /INPUT/ NAME, GRADE, DATE /OUTPUT/ TOTAL, NAME

For More Information:

For details on namelist I/O, see Sections 7.2.1.3 and 7.3.1.3.

Previous Page Next Page Table of Contents