File I/O status in sysVar.errorCode for iSeriesC
If the V60ExceptionCompatibility program property is set to YES, the sysVar.errorCode system variable contains the status code for file I/O in the iSeriesC environment.
For generated COBOL, use the sysCodes build
descriptor option to control the codes that are returned for file
I/O errors. The sysCodes build descriptor
option does not affect the EGL I/O error values.
- If you set the sysCodes build descriptor option to "YES", sysVar.errorCode contains system dependent access method return codes. This is the COBOL File Status Key. For information on the COBOL File Status Key values, see the i5/OS™ Information Center. For details on the format of sysVar.errorCode, see errorCode.
- By contrast, if you set sysCodes build descriptor option to "NO", sysVar.errorCode contains return codes from the EGL runtime services I/O routine that detected the IBM® i file I/O error.
The following table shows the correspondence between status key values, EGL I/O error values, and sysVar.errorCode. There are many COBOL File Status Key values that might correspond to a single sysVar.errorCode.
| errorCode (sysCodes = "YES"), COBOL File Status Key values | EGL I/O error value | errorCode (sysCodes = "NO") |
|---|---|---|
| 00,05,07 | [no error] | 000 |
| 02 | duplicate, ioError | 103 |
| 04 (Variable-length record) | [no error] | 000 |
| 04 | invalidFormat, ioError, hardIOError | 220 |
| 10,14,46 | endOfFile, ioError | 102 |
| 22 | unique, ioError | 206 |
| 23 (START) | endOfFile, ioError | 102 |
| 23 | noRecordFound, ioError | 205 |
| 24,34 (access method not relative or relative key not 0) | full, ioError, hardIOError | 25A |
| 35 | fileNotFound, ioError, hardIOError | 251 |
| 38 | fileNotAvailable, ioError, hardIOError | 218 |
| 39,95 | invalidFormat, ioError | 220 |
| 9D | deadlock, ioError, hardIOError | 381 |
For all other COBOL File Status Key values, sysVar.errorCode is
set based on the type of request as shown in the following table:
| Type of request | EGL I/O error value | errorCode (sysCodes = "NO") |
|---|---|---|
| OPEN | ioError, hardIOError | 500 |
| CLOSE, UNLOCK | ioError, hardIOError | 989 |
| READ, START | ioError, hardIOError | 987 |
| WRITE | ioError, hardIOError | 988 |