Formatted, indexed WRITE statements translate data from binary to character form by using format specifications for editing (if any). The translated data is written to an external file that is connected for keyed access.
No key parameters are required in the list of control parameters, because all necessary key information is contained in the output record.
When you use a formatted indexed WRITE statement to write an INTEGER key, the key is translated from internal binary form to external character form. A subsequent attempt to read the record by using an integer key may not match the key field in the record.
If the file is connected for unformatted I/O, formatted data transfer is prohibited.
Consider the following example (which assumes that the first 10 bytes of a record are a character key):
WRITE (4,100) KEYVAL, (RDATA(I), I=1, 20) 100 FORMAT (A10, 20F15.7)
The WRITE statement writes the translated values of each of the 20 elements of the array RDATA to a new formatted record in the indexed file connected to I/O unit 4. KEYVAL is the key by which the record is accessed.