FORTRAN Reference Manual
Statements
FORTRAN Reference Manual—528615-001
7-107
WRITE Statement
WRITE Statement
The WRITE statement outputs data to a specified unit.
unit
is one of the following:
°
An integer expression from 1 through 999 that corresponds to a unit previously 
connected by an OPEN statement or to a preconnected unit.
°
An asterisk (*), which implies unit 6. Unit 6 is preconnected for formatted 
sequential output.
°
An internal file identifier.
If you omit the UNIT keyword, unit must be the first item in the list. 
For information about external and internal files, see External and Internal Files on 
page 5-3.
write-spec
is one of the following:
[FMT] = format
format is either the label of a FORMAT statement in the same program unit, 
the name of an integer variable that has been assigned the label of a FORMAT 
statement, the name of a character array that contains a format specification, a 
character expression that yields a format specification, or an asterisk (*) 
indicating a list-directed WRITE statement.
If you omit the optional FMT keyword, format must be the second item on the 
control list and unit, without the UNIT specifier, must be the first item on the 
list.
REC = recno
recno is an INTEGER*2 or INTEGER*4 expression that specifies the record 
number of the record to write.
IOSTAT = ios
ios is a variable or array element of integer type that returns an error number 
or zero (no error) following the WRITE operation. For more information about 
error numbers, see the Error Numbers on page 6-5.
WRITE ( [UNIT=] unit [ [, write-spec ]... ] )
 [ output-item [, output-item ]... ]










