This is not quite consistent. The Fortran standard says

> WRITE specifies that READ statements shall not refer to this connection. READWRITE permits any input/output statements to refer to this connection.

Either the mode variable should be something else or the ACTION should be readwrite.