WRITE for sequential files
The maximum record size for sequential files is established at the time the file is created and cannot subsequently be changed.
After the WRITE statement is executed, the logical record is no longer available in record-name-1 unless either:
- The associated file is named in a SAME RECORD AREA clause (in which case, the record is also available as a record of the other files named in the SAME RECORD AREA clause)
- The WRITE statement is unsuccessful because of a boundary violation.
In either of these two cases, the logical 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 might or might 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 file status key is updated when the WRITE statement is executed, whether or not execution is successful.
The WRITE statement can only be executed for a sequential file opened in OUTPUT or EXTEND mode for QSAM files.
Punch function files with the IBM 3525
When the punch function is used, the next I-O operation after the READ statement must be a WRITE statement for the punch function file.
If you want to punch additional data into some of the cards and not into others, a dummy WRITE statement must be executed for the null cards, first filling the output area with SPACES.
If stacker selection for the punch function file is required, you can specify the appropriate stacker function-names in the SPECIAL-NAMES paragraph, and then code WRITE ADVANCING statements using the associated mnemonic-names.
Print function files
After the punch function operations (if specified) are completed, you can issue WRITE statements for the print function file.
If you wish to print additional data on some of the data cards and not on others, the WRITE statement for the null cards can be omitted. Any attempt to write beyond the limits of the card results in abnormal termination of the application, thus, the END-OF-PAGE phrase cannot be specified.
Depending on the capabilities of the specific IBM® 3525 model in use, the print file can be either a two-line print file or a multiline print file. Up to 64 characters can be printed on each line.
- For a two-line print file, the lines are printed on line 1 (top edge of card) and line 3 (between rows 11 and 12). Line control cannot be specified. Automatic spacing is provided.
- For a multiline print file, up to 25 lines of characters can be printed. Line control can be specified. If line control is not specified, automatic spacing is provided.
Line control is specified by issuing WRITE AFTER ADVANCING statements for the print function file. If line control is used for one such statement, it must be used for all other WRITE statements for the file. The maximum number of printable characters, including any space characters, is 64. Such WRITE statements must not specify space suppression.
Identifier and integer have the same meanings they have for other WRITE AFTER ADVANCING statements. However, such WRITE statements must not increase the line position on the card beyond the card limit, or abnormal termination results.
The mnemonic-name option of the WRITE AFTER ADVANCING statement can also be specified. In the SPECIAL-NAMES paragraph, the environment-names can be associated with the mnemonic-names, as shown in the following table:
environment-name | Meaning |
---|---|
C02 | Line 3 |
C03 | Line 5 |
C04 | Line 7 |
C05 | Line 9 |
... | ... |
C22 | Line 21 |
C12 | Line 23 |
Advanced Function Printing
When you use the WRITE ADVANCING phrase with a mnemonic-name associated with environment-name AFP-5A, a Print Services Facility (PSF) control character is placed in the control character position of the output record. This control character (X'5A') allows Advanced Function Printing (AFP) services to be used. For more information, refer to the documentation for the Print Services Facility product: PSF for OS/390® & z/OS® (5655-B17).