COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
record-name
is a logical record described in the File Section of the Data Division. The record-name can
be qualified by the name of the file with which the record is associated.
from-name
is the identifier of a data area whose contents are to be moved to the record specified by
record-name before the WRITE occurs. from-name must specify a data area other than
that specified by record-name. It also cannot specify an index data item.
invalid-key
executes imperative-statement when an invalid-key condition arises. This phrase is
required if no USE statement is applicable for the file.
not-invalid-key
executes imperative-statement when no invalid-key condition arises.
END-WRITE
ends the scope of the WRITE statement, causing the WRITE to be a delimited-scope statement.
If the WRITE statement does not end with an END-WRITE phrase, the presence of the INVALID
KEY or the NOT INVALID KEY phrase causes the WRITE statement to be a conditional statement,
which ends at the next period separator.
Usage Considerations:
• Action of the WRITE Statement
The write operation releases a logical record to the run-time routines for inclusion in the file.
For a file of relative or indexed organization, the order of the records in the file is determined
by the relative record number or the prime record key, respectively.
In general, the logical record consists of the value of the data item specified by record-name.
Records in a relative, indexed, or queue file can be any length from zero up to the maximum
length specified when the file was created.
Release of a logical record does not necessarily imply immediate transmission to the file. For
example, the actual transmission of a logical record to the file can be deferred until some time
after completion of the WRITE statement.
• File-Status Data Item
If the file has an associated file-status data item, execution of the WRITE statement always
assigns an appropriate I-O status code. The value “00” reports a successful write operation.
WRITE 495










