7.3.1.1 Formatted Sequential WRITE Statement

The formatted sequential WRITE statement performs the following operations:

The length of the records written to a user-specified output device (for example, a line printer) must not exceed the maximum record length that the device can process. In the case of a line printer, this maximum length is usually 132 characters.

When using an appropriate format specification, a statement can write more than one record.

If you transfer numeric data by using formatted output statements and you subsequently use the data as input, the resulting data may not be precise because of a rounding of the data during conversion from binary to character form. Therefore, if you expect to subsequently use numeric data as input and precision is important, use unformatted output and input statements for data transfer.

Examples

In the first example, the WRITE statement writes one record to logical unit 6. The record consists of the character constant defined in the FORMAT statement.

      WRITE (6,650)
650   FORMAT (' HELLO THERE')

In the second example, the WRITE statement writes one record consisting of fields AYE, BEE, and CEE to logical unit 1.

      WRITE (1,95) AYE, BEE, CEE
95    FORMAT (3F8.5)

In the third example, the WRITE statement writes three separate records to logical unit 1. Each record has only one field.

      WRITE (1,900) DEE, EEE, EFF
900   FORMAT (F8.5)


Previous Page Next Page Table of Contents