FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-110
WRITE Statement
If the value of upd is .TRUE., FORTRAN uses the WRITEUPDATE procedure to
update or delete a record. If the UNLOCK specifier is also present, FORTRAN
uses the WRITEUPDATEUNLOCK procedure.
If you omit this specifier or specify .FALSE. for upd, FORTRAN uses the WRITE
procedure to add a record to the file. For additional information about these
procedures, see the ENSCRIBE Programmer’s Guide.
LENGTH specifier
The LENGTH specifier returns the last byte position explicitly set when writing to
an internal file. When writing to an internal file that can have multiple records, len
must be an array with at least as many elements as there are records in the
internal file.
Following execution of the WRITE statement, each element of len that
corresponds to a record not reached by the WRITE operation contains a value of -
1; each element that corresponds to a record that was written contains the number
of bytes explicitly set.
TIMEOUT specifier
If the WRITE operation has not completed by the time to (where to is the timeout
value) centiseconds have elapsed, statement execution terminates with file system
error 40; if you use the IOSTAT specifier, ios returns 40.
You can use the TIMEOUT specifier to impose a time limit only if you specify
TIMED=.TRUE. when you open the file.
MSGNUM and REPLY specifiers
For information about these specifiers, see Section 14, Interprocess
Communication.
Implied DO list
See Using Implied DO Lists
on page 5-27.
Writing to unit 6
If you write a record to unit 6 and you have not already established a connection
for the unit, WRITE implicitly opens the unit using default parameters. If you
specify ENV COMMON and you write a record to unit 6, your FORTRAN routines
share access to standard output with routines written in other languages only if the
access mode for the unit is OUTPUT. However, the default access mode for unit 6
is I-O. If you want to share access to the file connected to unit 6, you must set the
unit’s access mode to OUTPUT before you execute the WRITE statement. You can
set the access mode:
In a FORTRAN OPEN statement, as in
OPEN( 6, MODE = 'OUTPUT')