Asynchronous Serial Communications Programmer's Reference Manual (32022-90052)

60 Chapter3
Common Device Control Functions
Reading From Asynchronous Devices
Reading From Asynchronous Devices
Data is read from a terminal by means of the FREAD, READ or READX
intrinsic. FREAD is the most versatile of the three, but requires the use
of a file number. READ allows reading from $STDIN only; READX
allows reading from $STDINX only. Neither READ nor READX requires
the use of a file number, but their utility is somewhat limited.
The manner in which a read from a terminal device takes place is
determined by the device control settings in effect for that device at the
time the read is issued. You can modify many of these settings by using
specific device control intrinsics prior to issuing a read.
The following paragraphs summarize the settings that are relevant
when reading input from a terminal device and the effect these settings
have on how a read will occur. See Chapter 8, “Intrinsics Reference,” of
this manual for details on using specific device control intrinsics.
Input Modes
When devices are connected asynchronously, data is always sent one
character at a time. The transmission of data may occur in either
character mode or block mode, depending on the physical settings of the
device and the settings of the ASC software controlling the device.
Character Mode
Under default conditions, transmission of data occurs in character
mode, with characters transmitted to the DTC individually as they are
typed in. When the read is terminated, the DTC transmits the
accumulated data to the host. If DTC echo is enabled, characters are
echoed back to the terminal screen as they are received. Under default
conditions, character mode reads are terminated by a carriage return.
Character mode is available with all supported terminal types and is
the mode in which all terminals are opened, whether by a session or a
program.
Block Mode
When a terminal is operating in block mode, characters are held in the
terminal’s internal memory (buffer) as they are typed in. They are not
transmitted to the DTC until after you have taken a specific action
(normally, pressing the
[Enter] key).
Data transmission may occur a line at a time (line block mode) or a
page at a time (page block mode) depending on the settings of the
terminal and the type of block mode being used.