# 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 also permitted.

An internal WRITE statement takes one of the following forms:

WRITE (iunit, format [, iostat] [, err] [, iomsg]) [io-list]

WRITE (iunit, nml-group [, iostat] [, err] [, iomsg]) [io-list]

For more information on syntax, see WRITE.

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

Parent topic: Forms for WRITE Statements

## See Also

I/O control-list specifiers
I/O lists
Rules for List-Directed Sequential WRITE Statements for details on list-directed output
Rules for Namelist Sequential WRITE Statements for details on namelist output