### 10.5.1.3 Rules for Namelist Sequential WRITE Statements

Namelist, sequential WRITE statements translate data from internal to external form by using the data types of the objects in the corresponding NAMELIST statement to determine the form of the data. The translated data is then written to an external file.

In general, values transferred as output have the same forms as values transferred as input.

By default, character constants are not delimited by apostrophes or quotation marks, and each internal apostrophe or quotation mark is represented externally by one apostrophe or quotation mark.

This behavior can be changed by the DELIM specifier (in an OPEN statement) as follows:

- If the file is opened with the DELIM='QUOTE' specifier, character constants are delimited by quotation marks and each internal quotation mark is represented externally by two consecutive quotation marks.
- If the file is opened with the DELIM='APOSTROPHE' specifier, character constants are delimited by apostrophes and each internal apostrophe is represented externally by two consecutive apostrophes.

Each output statement writes one or more complete records.

A literal character constant or complex constant can be longer than an entire record. In the case of complex constants, the end of the record can occur between the comma and the imaginary part, if the imaginary part and closing right parenthesis cannot fit in the current record.

Each output record begins with a blank character for carriage control, except for literal character constants that are continued from the previous record.

Slashes, octal values, null values, and repeated forms of values are not output.

If the file is connected for unformatted I/O, namelist data transfer is prohibited.

Examples

Consider 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,        &
             DIAGNOSTICS, ITERATIONS
    ...
    READ (UNIT=1,NML=PARAM)
    WRITE (UNIT=2,NML=PARAM)

Suppose the following input is read:

    &PARAM
        NAME(2)(10:)='HEISENBERG',
        PITCH=5.0, YAW=0.0, ROLL=5.0,
        DIAGNOSTICS=.TRUE.
        ITERATIONS=10
    /

The following is then written to the file connected to unit 2:

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

Note that character values are not enclosed in apostrophes unless the output file is opened with DELIM='APOSTROPHE'. The value of POSITION is not defined in the namelist input, so the current value of POSITION is written.

For More Information:

- On namelist input, see Section 10.3.1.3.
- On general rules for formatted, sequential WRITE statements, see Section 10.5.1.1.

Previous Page Next Page Table of Contents