omron — Disk I/O

Disk I/O directories. If a disk is thought of as a file cabinet, then a directory can be thought of as a drawer in that cabinet. Directories allow files (the file folders in our file cabinet analogy) that have some relationship to each other to be grouped together and separated from other files. See the chapter Using Files in the eV+ Operating System User's Guide for more details on the directory structure. Disk File Operations All I/O requests to a disk device are made to a file on that device. A disk file is a logical collection of data records 1 on a disk. Each disk file has a name, and all the names on a disk are stored in a directory on the disk.

The FDIRECTORY monitor command displays the names of the files on a disk. A disk file can be accessed either sequentially, where data records are accessed from the beginning of the file to its end, or randomly, where data records are accessed in any order. Sequential access is simplest and is assumed in this section. Random access is described later in this chapter. Opening a Disk File Before a disk file can be opened, the disk the file is on must be ATTACHed. The FOPEN_ instructions open disk files (and file directories). These instructions associate a LUN with a disk file. Once a file is open, the READ, GETC, and WRITE instructions access the file.

These instructions use the assigned LUN to access the file so that multiple files may be open on the same disk and the I/O operations for the different disk files will not affect each other. 2 The simplified syntax for FOPEN_ is: FOPEN _ (lun)file_spec where: lun logical unit number used in the ATTACH instruction file_spec file specification in the form, unit:path\filename.ext unit is an optional disk unit name. The standard local disk units are A, C, and D. If no unit is specified, the colon also must be omitted. Then the default unit (as determined by the DEFAULT command) is assumed. path\ is an optional directory path string.

The directory path is defined by one or more directory names, each followed by a \ character. The actual directory path is determined by combining any specified path with the path set by the DEFAULT command. If path is eV+Language User's Guide, v2.x, 18318-000 Rev A Page 144