List-directed, sequential WRITE statements transfer data from binary to character form by using the data types of the corresponding I/O list item to determine the form of the data. The translated data is then written to an external file.
In general, values transferred as output have the same forms as values transferred as input.
The following table shows the default output formats for each intrinsic data type:
Default Formats for List-Directed Output | ||
---|---|---|
Data Type | Output Format | |
BYTE | I5 | |
LOGICAL(1) | L2 | |
LOGICAL(2) | L2 | |
LOGICAL(4) | L2 | |
LOGICAL(8) | L2 | |
INTEGER(1) | I5 | |
INTEGER(2) | I7 | |
INTEGER(4) | I12 | |
INTEGER(8) | I22 | |
REAL(4) | 1PG15.7E2 | |
REAL(8) | 1PG24.15E3 | |
REAL(16) | 1PG43.33E4 | |
COMPLEX(4) | '(',1PG14.7E2,',',1PG14.7E2,')' | |
COMPLEX(8) | '(',1PG23.15E3,',',1PG23.15E3,')' | |
COMPLEX(16) | '(',1PG42.33E4,',',1PG42.33E4,')' | |
CHARACTER | Aw 1 | |
1 Where w is the length of the character expression. |
By default, character constants are not delimited by apostrophes or quotation marks, and each internal apostrophe or quotation mark is represented externally by one apostrophe or quotation mark.
This behavior can be changed by the DELIM specifier (in an OPEN statement) as follows:
Each output statement writes one or more complete records.
A literal character constant or complex constant can be longer than an entire record. For complex constants, the end of the record can occur between the comma and the imaginary part, if the imaginary part and closing right parenthesis cannot fit in the current record. For literal constants that are longer than an entire record, the constant is continued onto as many records as necessary.
Each output record begins with a blank character for carriage control.
Slashes, octal values, null values, and repeated forms of values are not output.
If the file is connected for unformatted I/O, list-directed data transfer is prohibited.
Examples
Suppose the following statements are specified:
DIMENSION A(4)
DATA A/4*3.4/
WRITE (1,*) 'ARRAY VALUES FOLLOW'
WRITE (1,*) A,4
The following records are then written to external unit 1:
ARRAY VALUES FOLLOW
3.400000 3.400000 3.400000 3.400000 4
The following shows another example:
INTEGER i, j
REAL a, b
LOGICAL on, off
CHARACTER(20) c
DATA i /123456/, j /500/, a /28.22/, b /.0015555/
DATA on /.TRUE./, off/.FALSE./
DATA c /'Here''s a string'/
WRITE (*, *) i, j
WRITE (*, *) a, b, on, off
WRITE (*, *) c
END
The preceding example produces the following output:
123456 500
28.22000 1.555500E-03 T F
Here's a string
See Also