## 10.5.4 Forms and Rules for Internal WRITE Statements

Internal WRITE statements transfer output data to an internal file.

An internal WRITE statement can only be formatted. It must include format specifiers (which can use list-directed formatting). Namelist formatting is not permitted.

An internal WRITE statement takes the following form:

  WRITE (iunit, format [, iostat] [, err]) [io-list]
  iunit
  Is an internal unit specifier ([UNIT=]io-unit). It must be a default character variable. It must not be an array section with a vector subscript.
  format
  Is a format specifier ([FMT=]format). An asterisk (*) indicates list-directed formatting.
  iostat
  Is a status specifier (IOSTAT=i-var).
  err
  Is a branch specifier (ERR=label) if an error condition occurs.
  io-list
  Is an I/O list.

Formatted, internal WRITE statements translate data from binary to character form by using format specifications for editing (if any). The translated data is written to an internal file.

Values can be transferred from objects of intrinsic or derived types. For derived types, values of intrinsic types are transferred from the components of intrinsic types that ultimately make up these structured objects.

If the number of characters written in a record is less than the length of the record, the rest of the record is filled with blanks. The number of characters to be written must not exceed the length of the record.

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.

Examples

The following example shows an internal WRITE statement:

      INTEGER J, K, STAT_VALUE
      CHARACTER*50 CHAR_50
      ...
      WRITE (FMT=*, UNIT=CHAR_50, IOSTAT=STAT_VALUE) J, K

For More Information:

- On I/O control-list specifiers, see Section 10.2.1.
- On I/O lists, see Section 10.2.2.
- On list-directed output, see Section 10.5.1.2.
- On using internal files, see your user manual or programmer's guide.

Previous Page Next Page Table of Contents