COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-297
WRITE for Sequential Files
The I-O status codes that result from an unsuccessful write operation are:
Invalid-Key Condition
When the sequential WRITE statement is used to write to an indexed file, or to
write to a file with alternate keys, the invalid-key condition arises when the I-O
status code is “21” or “22.”
Reel-Swap Sequence for Multiple-Reel Tape Files
If execution of a WRITE statement for a multiple-reel tape file exhausts the
capacity of the current reel, the run-time routine automatically performs a reel-
swap sequence. You can use the COBOL_SPECIAL_OPEN_ routine to notify the
program.
Page Headers and Trailers
If you want a page trailer, describe the footing area with a FOOTING value less
than or equal to the LINES value in the LINAGE clause. Then use an END-OF-
PAGE phrase to write a page trailer; eject the page, if necessary; and write the
next page header. If you want only a page header, omit the FOOTING phrase from
the LINAGE clause.
Multiple end-of-page conditions can occur during the production of one logical
page if several successive WRITE statements cause printing or spacing within that
logical page’s footing area.
I-O Status Code Unsuccessful Write Operation
“22 An alternate record key value of the logical record equals that of a
record that already exists in the file and duplicate values are not
allowed for that key (all access modes).
“30” The write operation failed due to non-COBOL causes. The
specified record might or might not have been written.
“34” A boundary violation exception exists when execution of a WRITE
statement would require exceeding the record storage capacity of
the file. The logical record is not released.
“44” When the file is described with the RECORD VARYING clause, the
logical record size must be neither greater than the maximum nor
less than the minimum number of character positions specified in
that clause. This requirement is not met, and the logical record is
not released.
“48” Either the file has sequential organization and is not open in I-O,
OUTPUT, or EXTEND mode; or the open mode is I-O, and the file
device is not a terminal, process, or $RECEIVE.
“90” The WRITE statement contains an ADVANCING phrase, and the
value of no-of-lines is a negative number other than -1.