XL Fortran for AIX 8.1

Language Reference

+-------------------------------IBM Extension--------------------------------+


Conditions and IOSTAT Values

An IOSTAT value is a value assigned to the variable for the IOSTAT= specifier if an end-of-file condition, end-of-record condition or an error condition occurs during an input/output statement. There are five types of error conditions: catastrophic, severe, recoverable, conversion, Fortran 90 and Fortran 95 language.

End-Of-Record Conditions

An end-of-record condition causes the IOSTAT= specifier to be set to -4 and the EOR= label to be branched to if these specifiers are present on the input/output statement. If the IOSTAT= and EOR= specifiers are not present on the input/output statement when an end-of-record condition is encountered, the program stops.

Table 6. IOSTAT Values for End-Of-Record Conditions

IOSTAT Value End-of-Record Condition Description
-4 End of record encountered on a nonadvancing, format-directed READ of an external file.

End-Of-File Conditions

An end-of-file condition can occur at the beginning of execution of an input statement or 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 causes the IOSTAT= specifier to be set to one of the values defined below and the END= label to be branched to if these specifiers are present on the input statement. If the IOSTAT= and END= specifiers are not present on the input statement when an end-of-file condition is encountered, the program stops.

Table 7. IOSTAT Values for End-Of-File Conditions

IOSTAT Value End-of-File Condition Description
-1 End of file encountered on sequential READ of an external file, or END= is specified on a direct access read and the record is nonexistent.
-2 End of file encountered on READ of an internal file.

Error Conditions

Catastrophic Errors

Catastrophic errors are system-level errors encountered within the run-time system that prevent further execution of the program. When a catastrophic error occurs, a short (non-translated) message is written to unit 0, followed by a call to the C library routine abort(). A core dump may result, depending on how your execution environment is configured.

Severe Errors

A severe error cannot be recovered from, even if the ERR_RECOVERY run-time option has been specified with the value YES. A severe error causes the IOSTAT= specifier to be set to one of the values defined below and the ERR= label to be branched to if these specifiers are present on the input/output statement. If the IOSTAT= and ERR= specifiers are not present on the input/output statement when a severe error condition is encountered, the program stops.

Table 8. IOSTAT Values for Severe Error Conditions

IOSTAT Value Error Description
1 END= is not specified on a direct access READ and the record is nonexistent.
2 End of file encountered on WRITE of an internal file.
6 File cannot be found and STATUS='OLD' is specified on an OPEN statement.
10 Read error on direct file.
11 Write error on direct file.
12 Read error on sequential file.
13 Write error on sequential file.
14 Error opening file.
15 Permanent I/O error encountered on file.
37 Dynamic memory allocation failure - out of memory.
38 REWIND error.
39 ENDFILE error.
40 BACKSPACE error.
107 File exists and STATUS='NEW' was specified on an OPEN statement.
119 BACKSPACE statement attempted on unit connected to a tape device.
122 Incomplete record encountered during direct access READ.
130 ACTION='READWRITE' specified on an OPEN statement to connect a pipe.
135 The user program is making calls to an unsupported version of the XL Fortran Run-time Environment.
139 I/O operation not permitted on the unit because the file was not opened with an appropriate value for the ACTION= specifier.
142 CLOSE error.
144 INQUIRE error.
152 ACCESS='DIRECT' is specified on an OPEN statement for an AIX file that can only be accessed sequentially.
153 POSITION='REWIND' or POSITION='APPEND' is specified on an OPEN statement and the file is an AIX pipe.
156 Invalid value for RECL= specifier on an OPEN statement.
159 External file input could not be flushed because the associated device is not seekable.
165 The record number of the next record that can be read or written is out of the range of the variable specified with the NEXTREC= specifier of the INQUIRE statement.
169 The asynchronous I/O statement cannot be completed because the unit is connected for synchronous I/O only.
172 The connection failed because the file does not allow asynchronous I/O.
173 An asynchronous READ statement was executed while asynchronous WRITE statements were pending for the same unit, or an asynchronous WRITE statement was executed while asynchronous READ statements were pending for the same unit.
174 The synchronous I/O statement cannot be completed because an earlier asynchronous I/O statement has not been completed.
175 The WAIT statement cannot be completed because the value of the ID= specifier is invalid.
176 The WAIT statement cannot be completed because the corresponding asynchronous I/O statement is in a different scoping unit.
178 The asynchronous direct WRITE statement for a record is not permitted because an earlier asynchronous direct WRITE statement for the same record has not been completed.
179 The I/O operation cannot be performed on the unit because there are still incomplete asynchronous I/O operations on the unit.
181 A file cannot be connected to a unit because multiple connections are allowed for synchronous I/O only.
182 Invalid value for UWIDTH= option. It must be set to either 32 or 64.
183 The maximum record length for the unit is out of the range of the scalar variable specified with the RECL= specifier in the INQUIRE statement.
184 The number of bytes of data transmitted is out of the range of the scalar variable specified with the SIZE= or NUM= specifier in the I/O statement.
185 A file cannot be connected to two units with different UWIDTH values.
186 Unit numbers must be between 0 and 2,147,483,647.

Recoverable Errors

A recoverable error is an error that can be recovered from. A recoverable error causes the IOSTAT= specifier to be set to one of the values defined below and the ERR= label to be branched to if these specifiers are present on the input/output statement. If the IOSTAT= and ERR= specifiers are not present on the input/output statement and the ERR_RECOVERY run-time option is set to YES, recovery action occurs and the program continues. If the IOSTAT= and ERR= specifiers are not present on the input/output statement and the ERR_RECOVERY option is set to NO, the program stops.

Table 9. IOSTAT Values for Recoverable Error Conditions

IOSTAT Value Error Description
16 Value of REC= specifier invalid on direct I/O.
17 I/O statement not allowed on direct file.
18 Direct I/O statement on an unconnected unit.
19 Unformatted I/O attempted on formatted file.
20 Formatted I/O attempted on unformatted file.
21 Sequential I/O attempted on direct file.
22 Direct I/O attempted on sequential file.
23 Attempt to connect a file that is already connected to another unit.
24 OPEN specifiers do not match the connected file's attributes.
25 RECL= specifier omitted on an OPEN statement for a direct file.
26 RECL= specifier on an OPEN statement is negative.
27 ACCESS= specifier on an OPEN statement is invalid.
28 FORM= specifier on an OPEN statement is invalid.
29 STATUS= specifier on an OPEN statement is invalid.
30 BLANK= specifier on an OPEN statement is invalid.
31 FILE= specifier on an OPEN or INQUIRE statement is invalid.
32 STATUS='SCRATCH' and FILE= specifier specified on same OPEN statement.
33 STATUS='KEEP' specified on CLOSE statement when file was opened with STATUS='SCRATCH'.
34 Value of STATUS= specifier on CLOSE statement is invalid.
36 Invalid unit number specified in an I/O statement.
47 A namelist input item was specified with one or more components of nonzero rank.
48 A namelist input item specified a zero-sized array.
58 Format specification error.
93 I/O statement not allowed on error unit (unit 0).
110 Illegal edit descriptor used with a data item in formatted I/O.
120 The NLWIDTH setting exceeds the length of a record.
125 BLANK= specifier given on an OPEN statement for an unformatted file.
127 POSITION= specifier given on an OPEN statement for a direct file.
128 POSITION= specifier value on an OPEN statement is invalid.
129 ACTION= specifier value on an OPEN statement is invalid.
131 DELIM= specifier given on an OPEN statement for an unformatted file.
132 DELIM= specifier value on an OPEN statement is invalid.
133 PAD= specifier given on an OPEN statement for an unformatted file.
134 PAD= specifier value on an OPEN statement is invalid.
136 ADVANCE= specifier value on a READ statement is invalid.
137 ADVANCE='NO' is not specified when SIZE= is specified on a READ statement.
138 ADVANCE='NO' is not specified when EOR= is specified on a READ statement.
145 READ or WRITE attempted when file is positioned after the endfile record.
163 Multiple connections to a file located on a non-random access device are not allowed.
164 Multiple connections with ACTION='WRITE' or ACTION='READWRITE' are not allowed.
170 ASYNCH= specifier value on an OPEN statement is invalid.
171 ASYNCH= specifier given on an OPEN statement is invalid because the FORM= specifier is set to FORMATTED.
177 The unit was closed while there were still incomplete asynchronous I/O operations.

Conversion Errors

A conversion error occurs as a result of invalid data or the incorrect length of data in a data transfer statement. A conversion error causes the IOSTAT= specifier to be set to one of the values defined below and the ERR= label to be branched to if these specifiers are present on the input/output statement and the CNVERR option is set to YES. If the IOSTAT= and ERR= specifiers are not present on the input/output statement, both the CNVERR option and the ERR_RECOVERY option are set to YES, recovery action is performed and the program continues. If the IOSTAT= and ERR= specifiers are not present on the input/output statement, the CNVERR option is set to YES, the ERR_RECOVERY option is set to NO, and the program stops. If CNVERR is set to NO, the ERR= label is never branched to but the IOSTAT= specifier may be set, as indicated below.

Table 10. IOSTAT Values for Conversion Error Conditions

IOSTAT Value Error Description IOSTAT set if CNVERR=NO
3 End of record encountered on an unformatted file. no
4 End of record encountered on a formatted external file using advancing I/O. no
5 End of record encountered on an internal file. no
7 Incorrect format of list-directed input found in an external file. yes
8 Incorrect format of list-directed input found in an internal file. yes
9 List-directed or NAMELIST data item too long for the internal file. yes
41 Valid logical input not found in external file. no
42 Valid logical input not found in internal file. no
43 Complex value expected using list-directed or NAMELIST input in external file but not found. no
44 Complex value expected using list-directed or NAMELIST input in internal file but not found. no
45 NAMELIST item name specified with unknown or invalid derived-type component name in NAMELIST input. no
46 NAMELIST item name specified with an invalid substring range in NAMELIST input. no
49 List-directed or namelist input contained an invalid delimited character string. no
56 Invalid digit found in input for B, O or Z format edit descriptors. no
84 NAMELIST group header not found in external file. yes
85 NAMELIST group header not found in internal file. yes
86 Invalid NAMELIST input value found in external file. no
87 Invalid NAMELIST input value found in internal file. no
88 Invalid name found in NAMELIST input. no
90 Invalid character in NAMELIST group or item name in input. no
91 Invalid NAMELIST input syntax. no
92 Invalid subscript list for NAMELIST item in input. no
94 Invalid repeat specifier for list-directed or NAMELIST input in external file. no
95 Invalid repeat specifier for list-directed or NAMELIST input in internal file. no
96 Integer overflow in input. no
97 Invalid decimal digit found in input. no
98 Input too long for B, O or Z format edit descriptors. no
121 Output length of NAMELIST item name or NAMELIST group name is longer than the maximum record length or the output width specified by the NLWIDTH option. yes

Fortran 90 and Fortran 95 Language Errors

A Fortran 90 language error results from the use of XL Fortran extensions to the Fortran 90 language that cannot be detected at compile time. A Fortran 90 language error is considered a severe error when the LANGLVL run-time option has been specified with the value 90STD and the ERR_RECOVERY run-time option has either not been set or is set to NO. If both LANGLVL=90STD and ERR_RECOVERY=YES have been specified, the error is considered a recoverable error. If LANGLVL= EXTENDED is specified, the error condition is not considered an error.

A Fortran 95 language error results from the use of XL Fortran extensions to the Fortran 95 language that cannot be detected at compile time. A Fortran 95 language error is considered a severe error when the LANGLVL run-time option has been specified with the value 95STD and the ERR_RECOVERY run-time option has either not been set or is set to NO. If both LANGLVL=95STD and ERR_RECOVERY=YES have been specified, the error is considered a recoverable error. If LANGLVL=EXTENDED is specified, the error condition is not considered an error.

Table 11. IOSTAT Values for Fortran 90 and Fortran 95 Language Error Conditions

IOSTAT Value Error Description
53 Mismatched edit descriptor and item type in formatted I/O.
58 Format specification error.
140 Unit is not connected when the I/O statement is attempted. Only for READ, WRITE, PRINT, REWIND, and ENDFILE.
141 Two ENDFILE statements without an intervening REWIND or BACKSPACE on the unit.
151 The FILE= specifier is missing and the STATUS= specifier does not have a value of 'SCRATCH' on an OPEN statement.
187 NAMELIST comments are not allowed by the Fortran 90 standard.

+----------------------------End of IBM Extension----------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]