The WRITE statement releases a logical record for an output or input-output file. For sequential files it can also be used for vertical positioning of lines within a logical page.
Although they are a part of the standard COBOL definition, mnemonic names in the ADVANCING phrase are explicitly excluded from the X/Open COBOL language definitions and should not be used in X/Open COBOL source programs.
This restriction can be ignored.
Alternatively, function-name can itself be used instead of an associated mnemonic-name.
MOVE identifier-1 TO record-name
according to the rules specified for the MOVE statement:
The contents of the record area prior to the execution of the implicit MOVE statement have no effect on the execution of this WRITE statement.
After execution of the WRITE statement is complete, the information in the area referenced by identifier-1 is available, even though the information in the area referenced by record-name is not. (See General Rule 13.)
An automatic page overflow condition is reached whenever the execution of a given WRITE statement (with or without an END-OF-PAGE phrase) cannot be fully accommodated within the current page body.
This occurs when a WRITE statement, if executed, would cause the LINAGE-COUNTER to exceed the value specified by integer-1 or the data item referenced by data-name-1 of the LINAGE clause. In this case, the record is presented on the logical page before or after (depending on the phrase used) the device is repositioned to the first line that can be written on the next logical page as specified in the LINAGE clause. The imperative statement in the END-OF-PAGE clause, if specified, is executed after the record is written and the device has been repositioned.
If integer-2 or data-name-2 of the LINAGE clause is not specified, no end-of-page condition distinct from the page overflow condition is detected. In this case, the end-of-page condition and page overflow condition occur simultaneously.
If integer-2 or data-name-2 of the LINAGE clause is specified, but the execution of a given WRITE statement would cause LINAGE-COUNTER to simultaneously exceed the value of both integer-2 or the data item referenced by data-name-2 and integer-1 or the data item referenced by data-name-1, then the operation proceeds as if integer-2 or data-name-2 had not been specified.
If the ADVANCING phrase is not used, automatic advancing is provided when output is directed to a list device (PRINTER or PRINTER-1), to act as if you had specified AFTER ADVANCING 1 LINE. If the ADVANCING phrase is used, advancing is provided as follows:
The logical record is also available as a record of other files referenced in the SAME RECORD AREA clause as the associated output file, as well as the file associated with record-name.
If the integer-1 option is used, then the character placed in the output record is determined as follows:
|0||1||Skip to channel 1|
The logical record is also available as a record of other files referenced in the same SAME RECORD AREA clause as the associated output file, as well as the file associated with record-name.