IOSTAT real-valued function Details Unlike most eV+ instructions, I/O instructions do not force the program to stop when an error is detected. Instead, the error status is stored internally for access with the IOSTAT function. This feature allows the program to interpret and possibly recover from many I/O errors. When reading a file of unknown length, IOSTAT is the only method to determine when the end of the file is reached. The value returned for modes 0, 1, and 3 is one of the following: Examples Try to open a file for reading, and make sure the file exists. If the file does exist, record its size (in bytes).
ATTACH (dlun, 4) "DISK" FOPENR (dlun) "RECORD.DAT" IF IOSTAT(dlun) 0 THEN TYPE "Error opening file" HALT END file.size = IOSTAT(dlun,2) Read and display records until the end of the file is reached. ieeof = -504 ;End-of-file error code READ (dlun) $record WHILE IOSTAT(dlun) > 0 DO TYPE $record READ (dlun) $record END IF IOSTAT(dlun) == ieeof THEN TYPE "Normal end of file" ELSE TYPE /B, "I/O error ", $ERROR(IOSTAT(dlun)) END eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 305 IOSTAT Value Returned on EOF Description 1 Normal success; for mode 3 this value indicates that no write request is outstanding. 0 Operation not yet complete Standard eV+ error number.
See System Messages for a description of standard eV+ error numbers.