u is either an external unit identifier or an internal file identifier.
An external unit identifier must be one of the following:
A nonnegative integer expression
An asterisk, identifying stdout, which is normally connected to the console
If the optional characters UNIT= are omitted from the unit specifier, then u must be the first item in the list of specifiers.
f is a format identifier and can be:
An asterisk (*), indicating list-directed I/O. See "List-Directed I/O " for more information.
The label of a FORMAT statement that appears in the same program unit
An integer variable name that has been assigned the label of a FORMAT statement that appears in the same program unit
A character expression or integer array that specifies the format string. This is called a runtime format or a variable format. The integer array is nonstandard. @
See "Runtime Formats " for details on formats evaluated at runtime.
If the optional characters, FMT=, are omitted from the format specifier, then f must appear as the second argument for a formatted write; otherwise, it must not appear at all.
f must not be an asterisk for direct access.
f can be an asterisk for internal files. @
If a file is connected for formatted I/O, unformatted data transfer is prohibited, and vice versa.
ios must be an integer variable, integer array element, or integer record field.
rn must be a positive integer expression. This argument can appear only for direct-access files. rn can be specified for internal files. @
s must be the label of an executable statement in the same program unit in which this WRITE statement occurs.
iolist can be empty, or it can contain output items or implied DO lists. The output items must be one of the following:
Any other expression
A simple unsubscripted array name specifies all of the elements of the array in memory storage order, with the leftmost subscript increasing more rapidly.
Implied DO lists are described in "Implied DO Lists".
If the output item is a character expression that employs the concatenation operator, the length specifiers of its operands can be an asterisk (*). This rule is nonstandard. @
If a function appears in the output list, that function must not cause an input/output statement to be executed.
The second form of WRITE is used to output the items of the specified namelist group. Here, grname is the name of the list previously defined in a NAMELIST statement.
Execution proceeds as follows:
The file associated with the specified unit is determined.
The format, if specified, is established. The file is positioned appropriately prior to data transfer.
If the output list is not empty, data is transferred from the list to the file.
Data is edited according to the format, if specified.
In the second form of namelist-directed WRITE, the data is transferred from the items of the specified namelist group according to the rules of namelist-directed output.
The file is repositioned appropriately after the data transfer.
If ios is specified, and no error occurs, it is set to zero; otherwise, it is set to a positive value.
If s is specified and an error occurs, control is transferred to s.