When an attempt is made to write beyond the externally defined boundaries of the file, the processing of the WRITE statement is unsuccessful and an EXCEPTION/ERROR condition exists. The contents of record-name are unaffected. Processing then follows the rules for error handling as described under USE Statement Programming Notes.
No indication that an end-of-volume has occurred is returned to the program.
WRITE Statement - Format 1 - Sequential Files >>-WRITE--record-name-1--+--------------------+-----------------> '-FROM--identifier-1-' >--+------------------------------------------------------------+--> '-+-BEFORE-+--+-----------+--+-+-identifier-2-+--+-------+-+-' '-AFTER--' '-ADVANCING-' | '-integer-1----' +-LINE--+ | | '-LINES-' | +-mnemonic-name-1-------------+ '-PAGE------------------------' >--+------------------------------------+-----------------------> | (1) | '-NULL-MAP------+----+--identifier-9-' '-IS-' >--+-------------------------------------------------+----------> '-+----+--+-END-OF-PAGE-+--imperative-statement-1-' '-AT-' '-EOP---------' >--+------------------------------------------------------+-----> '-NOT--+----+--+-END-OF-PAGE-+--imperative-statement-2-' '-AT-' '-EOP---------' >--+-----------+----------------------------------------------->< '-END-WRITE-'
You must ensure that the size of an OCCURS DEPENDING ON (ODO) array has been set to a valid numeric value before doing a WRITE of a record containing the ODO array.
Record-name-1 can be a floating-point data item.
Record-name-1 can define a DBCS data item. Identifier-1 must be a DBCS data-item if record-name-1 is a DBCS data item.
MOVE identifier-1 TO record-name-1
WRITE record-name-1
The move is performed according to the rules of the MOVE statement, without the CORRESPONDING phrase.
After the WRITE statement is executed, the information is still available in identifier-1, even though it may not be in record-name-1. (See INTO/FROM Identifier Phrase.)
Identifier-1 can be the name of an alphanumeric or DBCS function identifier.
Identifier-1 can be a floating-point or date-time data item.
The maximum record size for the file is established at the time the file is created, and cannot subsequently be changed.
Record-name-1 and identifier-1 must not refer to the same storage area.
In either of these two cases, the record is still available in record-name-1.
The file position indicator is not affected by execution of the WRITE statement.
The number of character positions required to store the record in a file may or may not be the same as the number of character positions defined by the logical description of that record in the COBOL program. (See PICTURE Clause Editing and USAGE Clause.)
If the FILE STATUS clause is specified in the File-Control entry, the associated status key is updated when the WRITE statement is executed, whether or not execution is successful.
The WRITE statement cannot be executed for a sequential file opened in I-O mode.