COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-295
WRITE for Sequential Files
imperative-statement
is an imperative statement to be executed when an invalid-key condition arises
because alternate keys are defined for the sequential file, and the write
operation would create a duplicate key when the file definition did not specify
that duplicates are allowed. If no INVALID KEY phrase is present, a USE
procedure must be present for the file or files to be opened in OUTPUT mode.
not-invalid-key-phrase
executes imperative-statement when the write operation does not encounter
the invalid-key condition. The file description cannot include a LINAGE clause.
imperative-statement
is an imperative statement to be executed when an invalid-key condition does
not arise.
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 AT END-OF-PAGE, the NOT AT END-OF-PAGE, 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 sequential organization, the order of the records in the file
therefore corresponds to the order in which they are released.
In general, the logical record consists of the value of the data item specified by
record-name ; however, when the file has fixed-length records, and the record-
name item contains fewer than the defined number of character positions, the
logical record is extended with arbitrary character values.
•
Printer or Spooler Files
Release of a logical record does not necessarily imply immediate transmission to
the file. The record can be held in an internal buffer.
In the non-CRE environment, the actual transmission of a logical record to the file
or spooler buffer can be deferred until some time after completion of the WRITE
statement.
KEY
imperative-statementINVALID
VST239.vsd