01-393 Subject: Proposed rewrite of section 9.9 Date: December 12, 2001 Reference: 01-357R1 In section 2 of 357R1, Van Snyder proposed merging section 9.5.3 into section 9.9 and offered a set of edits for the merger. This paper is a draft of the new section 9.9 in its entirety. Sub group feels this is easier to read than a set of edits. Once a final set of changes is agreed on, a set of edits to 007/R4 will be produced. Van proposed deleting 9.5.3 entirely. He would move about the first half to the start of 9.9 and completely delete the last half of 9.5.3. Subgroup proposes to also delete the last two paragraphs of the text Van would move--we'll keep the first third and delete the last two thirds. Within this draft, fonts are used to indicate where things came from. This is an example of text that is unchanged from 9.9 This is an example of text new to 9.9 This is an example of text deleted from 9.9 For convenience section 9.5.3 is also included below. Lines beginning with >>>> are notes that obviously won't appear in the text. -------------------------------------------------------- 9.5.3 Error, end-of-record, and end-of-file conditions >>>>> begin copy to 9.9 The set of input/output error conditions is processor dependent. An end-of-record condition occurs when a nonadvancing input statement attempts to transfer data from a position beyond the end of the current record, unless the file is a stream file and the current record is at the end of the file (an end-of-file condition occurs instead). An end-of-file condition occurs in the following cases: (1) When an endfile record is encountered during the reading of a file connected for sequential access. (2) When an attempt is made to read a record beyond the end of an internal file. (3) When an attempt is made to read beyond the end of a stream file. An end-of-file condition may occur at the beginning of execution of an input statement. An end-of-file condition also may occur during execution of a formatted input statement when more than one record is required by the interaction of the input list and the format. An end-of-file condition also may occur during execution of a stream input statement. >>>>end copy to start of 9.9 >>>>>begin subgroup delete If an error condition or an end-of-file condition occurs during execution of an input/output statement, execution of the input/output statement terminates and if the input/output statement contains any implied-DOs, all of the implied-DO variables in the statement become undefined. If an error condition occurs during execution of an input/output statement, the position of the file becomes indeterminate. If an error or end-of-file condition occurs on input, all input list items or namelist group objects become undefined. >>>>end subgroup delete >>>>begin Van's delete If an end-of-record condition occurs during execution of a nonadvancing input statement, the following occurs: if the pad mode has the value YES, the record is padded with blanks (9.5.4.4.2) to satisfy the input list item and corresponding data edit descriptor that require more characters than the record contains; execution of the input statement terminates and if the input statement contains any implied-DOs, all of the implied-DO variables in the statement become undefined; and the file specified in the input statement is positioned after the current record. If an error condition occurs during execution of an input/output statement that contains an IOSTAT= or ERR=specifier, an end-of-file condition occurs during execution of an input/output statement that contains an IOSTAT= or END= specifier, or and end-of-record condition occurs during execution of an input/output statement that contains an IOSTAT= or EOR= specifier, then execution continues as specified in 9.9. Execution of the program is terminated if an error condition occurs during execution of an input/output statement that contains neither an IOSTAT= nor ERR= specifier, an end-of-file condition occurs during execution of an input/output statement that contains neither an IOSTAT= nor END= specifier, or an end-of-record condition occurs during execution of an input/output statement that contains neither an IOSTAT= specifier nor EOR= specifier. >>>end delete -------------------------------------------------------- 9.9 Error processing >>>>begin copied in from 9.5.3 The set of input/output error conditions is processor dependent. An end-of-record condition occurs when a nonadvancing input statement attempts to transfer data from a position beyond the end of the current record, unless the file is a stream file and the current record is at the end of the file (an end-of-file condition occurs instead). An end-of-file condition occurs in the following cases: (1) When an endfile record is encountered during the reading of a file connected for sequential access. (2) When an attempt is made to read a record beyond the end of an internal file. (3) When an attempt is made to read beyond the end of a stream file. An end-of-file condition may occur at the beginning of execution of an input statement. An end-of-file condition also may occur during execution of a formatted input statement when more than one record is required by the interaction of the input list and the format. An end-of-file condition also may occur during execution of a stream input statement. >>>>>end copy in from 9.5.3 Error processing takes place if an error occurs during execution of an input/output statement that has an IOSTAT= or ERR= specifier, an end-of-file condition occurs during execution of an input/output statement that has an IOSTAT= or END= specifier, or an end-of-record condition occurs during execution of an input/output statement that has an IOSTAT= or EOR= specifier. >>>>>>sections 9.9.1 and 9.9.2 are moved as is to the end of 9.9 9.9.3 Error conditions and the ERR= specifier If an error condition (9.5.3) occurs during execution of an input/output statement that contains an ERR= specifier If an error condition occurs during execution of an input/output statement, the position of the file becomes indeterminate. If an error condition occurs during execution of an input/output statement that contains neither an ERR= or IOSTAT= specifier, execution of the program is terminated. If an error condition occurs during execution of an input/output statement that contains either an ERR= specifier or an IOSTAT specifier (1) Processing of the input/output, if any, list terminates, (2) The position of the file specified in the input/output statement becomes indeterminate, (2) If the statement is a data transfer statement or the error occurs during a wait operation, all implied DO variables in the statement that initiated the transfer become undefined, (3) If the input/output statement also contains an IOSTAT= specifier, the variable specified becomes defined as specified in 9.9.1, (4) If the input/output statement also contains an IOMSG= specifier, iomsg-variable becomes defined as specified in 9.9.2, (5) If the statement is a READ statement and it contains a SIZE= specifier, the variable specified becomes defined as specified in 9.5.1.4, and with an integer value(9.5.1.14), and (5.5) If the statement is a READ statement or the error condition occurs in a wait operation for a transfer initiated by a READ statement, all input items or namelist group objects in the statement that initiated the transfer become undefined, (6) If an ERR= specifier appears, execution continues with the statement specified in the ERR= specifier. 9.9.4 End-of-file conditions and the END= specifier If an end-of-file condition (9.5.3) occurs and no error condition (9.5.3) occurs during execution of an input statement that contains an END= specifier. If an end of file condition occurs during execution of an input/output statement that contains neither an END= specifier nor an IOSTAT= specifier, execution of the program is terminated. Otherwise if an error condition does not occur (1) Processing of the input list, if any, terminates, (1.3) If the statement is a data transfer statement or the error occurs during a wait operation, all implied DO variables in the statement that initiated the transfer become undefined, (1.7) If the statement is a READ statement or the end of file condition occurs in a wait operation for a transfer initiated by a READ statement, all input list items or namelist group objects in the statement that initiated the transfer become undefined, (2) If the file specified in the input statement is an external record file, it is positioned after the endfile record, (3) If the input/output statement also contains an IOSTAT= specifier, the variable specified becomes defined as specified in 9.9.1, (4) If the input/output statement also contains an IOMSG= specifier, iomsg-variable becomes defined as specified in 9.9.2, and (5) If an END= specifier appears, execution continues with the statement specified in the END= specifier. 9.9.5 End of record conditions and the EOR= specifier If an end-of-record condition (9.5.3) occurs and no error condition (9.5.3) or end-of-file condition (9.5.3) occurs during execution of an input statement that contains an EOR= specifier If an end of record condition occurs during a data transfer initiated by a nonadvancing input statement, the statement in which the condition is detected has neither an EOR= nor an IOSTAT= specifier, and the pad mode has the value NO, execution of the program is terminated. (1) If the pad mode has the value YES, the record is padded with blanks to satisfy the input list item (9.5.4.4.2) and corresponding data edit descriptor that requires more characters than the record contains, (2) Processing of the input list, if any, terminates, (2.5) If the statement is a data transfer statement or the error occurs during a wait operation, all implied DO variables in the statement that initiated the transfer become undefined, (3) The file specified in the input/output statement is positioned after the current record, (4) If the input/output statement also contains an IOSTAT= specifier, the variable specified becomes defined as specified in 9.9.1, (5) If the input/output statement also contains an IOMSG= specifier, iomsg-variable becomes defined as specified in 9.9.2, (6) If the input statement contains a SIZE= specifier, the variable specified becomes defined as specified in 9.5.1.4, and with an integer value(9.5.1.14), and (7) If an EOR= specifier appears, execution continues with the statement specified in the EOR= specifier. >>>> Section 9.9.1 gets moved to the end, unmodified. 9.9.1 IOSTAT= specifier Execution of an input/output statement containing the IOSTAT= specifier causes the variable specified in the IOSTAT= specifier to become defined (1) With a zero value if neither an error condition, an end-of-file condition, nor an end-of-record condition occurs, (2) With a processor-dependent positive integer value if an error condition occurs, (3) With the processor-dependent negative integer value of the constant IOSTAT END of the intrinsic module ISO FORTRAN ENV (13.8.2.1) if an end-of-file condition occurs and no error condition occurs, or (4) With a processor-dependent negative integer value of the constant IOSTAT EOR of the intrinsic module ISO FORTRAN ENV (13.8.2.2) if an end-of-record condition occurs and no error condition or end-of-file condition occurs. NOTE 9.59 An end-of-file condition may occur only for sequential or stream input and an end-of-record condition may occur only for nonadvancing input (9.5.3). Consider the example: READ (FMT = ''(E8.3)'', UNIT = 3, IOSTAT = IOSS) X IF (IOSS < 0) THEN ! Perform end-of-file processing on the file connected to unit 3. ELSE IF (IOSS > 0) THEN CALL END PROCESSING ! Perform error processing CALL ERROR PROCESSING END IF 9.9.2 IOMSG= specifier If an error, end-of-file, or end-of-record condition occurs during execution of an input/output statement, the processor shall assign an explanatory message to iomsg-variable. If no such condition occurs, the processor shall not change the value of iomsg-variable. >>>>>> end of copy to the end Page 7 of 7