omron — FSEEK program instruction

FSEEK program instruction FSEEK program instruction Syntax FSEEK (logical_unit, record_number ) Function Position a file open for random access and initiate a read operation on the specified record. Usage Considerations A file must be open for random access on the specified logical unit (see the FOPEN_ instruction). For efficiency in most applications, the file should be opened in no preread mode. Parameters logical_unit Real-valued expression that identifies the device to be accessed. (See the ATTACH instruction for a description of unit numbers.) record_number Optional real-valued expression that specifies the record to read for file-oriented devices opened in random-access mode.

If omitted, the record following the one last read is assumed. Details When a file is open for random access, system performance can be improved by overlapping the time required for disk file access with processing of the current data. By using the FSEEK instruction, an application program can initiate a disk seek and possible read operation immediately after a READ instruction is processed but before processing the data. Any error in the specification of this instruction (such as referencing an invalid unit) causes a program error and halts program execution.

However, errors associated with performing the actual seek operation (such as end of file or device not ready) do not halt program execution since these errors may occur in the normal operation of a program. These normal errors can be detected by using the IOSTAT function after performing the subsequent READ operation. In general, it is good practice always to test whether each file operation completed successfully by testing the value from IOSTAT. Example ; Seek record number 130 in the file open on logical unit 5: FSEEK (5, 130) eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 261