COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
The I-O status codes that result from an unsuccessful write operation are:
Unsuccessful Write OperationI-O Status Code
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).
“22”
The write operation failed due to non-COBOL causes. The specified record might or might
not have been written.
“30”
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.
“34”
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
“44”
positions specified in that clause. This requirement is not met, and the logical record is
not released.
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.
“48”
The WRITE statement contains an ADVANCING phrase, and the value of no-of-lines is a
negative number other than -1.
“90”
• 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.
• Page Overflow
An automatic page overflow condition exists whenever the execution of a write statement
cannot be fully accommodated within the current page body of a printer file described with
a LINAGE clause. This situation arises when the execution of the WRITE statement would cause
the LINAGE-COUNTER to assume a value greater than the number of lines in the current page
body.
In this case, the process prints the record on the logical page before or after advancing the
device to the first line following the top margin of the next logical page.
If the END-OF-PAGE phrase appears in the WRITE statement, then its imperative statement is
executed after both the print and advancing operations are completed.
When execution of a WRITE statement causes both the end-of-page and the page overflow
conditions to occur, only the actions for the page overflow condition occur.
• Buffered Cache
Buffered cache, enabled by the RESERVE clause of the FILE-CONTROL paragraph, speeds the
writing of disk files. This technique buffers records up in cache rather than writing them
immediately to disk.
WRITE 491










