omron — READ program instruction

READ program instruction NOTE: For a no-wait READ to access a serial line, the line must be configured to use DDCMP. Bit 2 Echo (0) vs. No-echo (1) (mask value = 2) If this bit is clear, input from the terminal is echoed back to the source. If the bit is set, characters are not echoed back to the source. (This mode bit is ignored for the serial lines.) var_list Either a list of real-valued input variables or a list of string variables, which receives the data (see following details). Details This is a general-purpose data input instruction that reads a record from a specified logical unit. A record can contain an arbitrary list of characters but must not exceed 512 characters in length.

For files that are opened in fixed-length record mode, this instruction continues to read characters until it has read exactly the number of characters specified during the corresponding FOPEN_ instruction. For variable-length record mode (with most devices), this instruction reads characters until the first carriage-return (CR) and line-feed (LF) character sequence (or Ctrl+Z) is encountered. Thus, for example, if you perform a variable-length record mode read from the disk, you receive all the characters until a CR and LF are encountered. The special character Ctrl+Z (26 decimal) indicates the logical end of the file, which is reported as an error by the IOSTAT function.

No input characters can be read beyond that point. READ operations from the terminal, the pendant, and the serial lines are always assumed to be in variable-length record mode. Except as noted below, the records are terminated by CR and LF (which are not returned as part of the record). Thus, a READ from these devices is not complete until a CR and LF are received as input. For example, if you perform a READ from the terminal, you receive all the characters until the RETURN key is pressed. NOTE: When a CR is received from the system terminal, eV+ automatically adds a LF. Similarly, the pendant's DONE key is interpreted as CR and LF.

The GETC real-valued function can be used instead of the READ instruction if you want to receive the CR and LF characters at the end of a record. When a READ instruction accesses a serial line configured to use DDCMP, the record may contain arbitrary data, including CR and LF characters. If bit 1 is set in the mode value, a read operation that is not complete does not cause the program to wait, but returns immediately with the error *No data received* (error code - eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 425