Serial and Disk I/O Basics Serial and Disk I/O Basics The following sections describe the basic procedures that are common to both serial and disk I/O operations. Disk I/O on page 143 covers disk I/O in detail. Serial Line I/O on page 152 covers serial I/O in detail. Logical Units All eV+ serial and disk I/O operations reference an integer value called a Logical Unit Number or LUN. The LUN provides a shorthand method of identifying which device or file is being referenced by an I/O operation. See the ATTACH command in the eV+ Language Reference Guide for the default device LUN numbers. Disk devices are different from all the other devices in that they allow files to be opened.
Each program task can have one file open on each disk LUN. That is, each program task can have multiple files open simultaneously (on the same or different disk units). NOTE: No more than 60 disk files can be open by the entire system at any time. That includes files opened by programs and by the system monitor (for example, for the FCOPY command). The error *Device not ready* results if an attempt is made to open a 61 st file. For details on accessing the graphics window LUNs, see Graphics Programming on page 161. Error Status Unlike most other eV+ instructions, I/O operations are expected to fail under certain circumstances.
For example, when reading a file, an error status is returned to the program to indicate when the end of the file is reached. The program is expected to handle this error and continue execution. Similarly, a serial line may return an indication of a parity error, which should cause the program to retry a data transmission sequence. For these reasons, eV+ I/O instructions normally do not stop program execution when an error occurs. Instead, the success or failure of the operation is saved internally for access by the IOSTAT real-valued function. For example, a reference to IOSTAT(5) returns a value indicating the status of the last I/O operation performed on LUN 5.
The values returned by IOSTAT fall into one of following three categories: IOSTAT Return Values eV+Language User's Guide, v2.x, 18318-000 Rev A Page 139 Value Explanation 1 The I/O operation completed successfully. 0 The I/O operation has not yet completed. This value appears only if a pre-read or no-wait I/O is being performed. The I/O operation completed with an error. The error code indicates