To: J3 J3/20-153r1 From: Robert Corbett Subject: ambiguous READ References: 20-007 Date: 2020-October-13 The statement READ (CVAR) where CVAR is a default character variable is syntactically ambiguous. Syntax rule R1210 of 20-007 has two alternatives. The statement can be derived from both alternatives. The first alternative is READ ( \si{io-control-spec-list} ) [ \si{input-item-list ] In this alternative, CVAR is the \si{io-control-spec-list}, and the statement is an input statement that reads from an internal file. The second alternative is READ \si{format} [ , \si{input-item-list} ] In this alternative, CVAR is a named variable in the parenthesized expression "(CVAR)" that is the \si{format}. If the statement is interpreted as an input statement that reads from an internal file, it is not standard conformant. Paragraph 2 of subclause 12.6.4.3 "Identifying a unit" of 20-007 states The unit identified by an unformatted data transfer statement shall be an external unit. The interpretation of the statement as a formatted input statement has no such problem. To resolve the syntactic ambiguity, the restriction presented in subclause 12.6.4.3 should be promoted to a constraint. Edits to 20-007 are supplied. EDITS to 20-007: [12.6.1 "Form of input and output statements" p1+, page:9-] Following Note 1, insert the new note "Note 2 A statement of the form READ (\su{name}) where \su{name} is the name of a default character variable is a formatted input statement. The format expression "(\su{name})" is the \si{format}. The statement cannot be an input statement that specifies an internal file because of C1219a." [12.6.2.1 "Syntax" p1+, page 233:13+] Insert "C1219a (R1213) If \si{io-unit} is an \si{internal-file-variable}, the \si{io-control-spec-list} shall contain a \si{format} or a \si{namelist-group-name}. [12.6.4.3 "Identifying a unit" p2, page 241:3] Delete the paragraph "The unit identified ... unit."