Asynchronous Serial Communications Programmer's Reference Manual (32022-90052)
Chapter 9 277
Intrinsics Reference (cont)
READ
READ
Transfers a record of data from the file $STDIN to the data area.
Syntax
I16 CA I16V
transfercount
:=READ(message,expectedlength);
Use
The READ intrinsic reads an ASCII string from $STDIN into an array.
This is similar to calling the FREAD intrinsic against the file $STDIN.
READ is intended as a quick method of obtaining input from the
terminal for temporary programming. Read timers or timeouts must be
set prior to calling READ by first calling FCONTROL using the
appropriate controlcode values.
When you use the READ intrinsic, the full capabilities of the file system
are not available to you. For example, since no file number can be
specified in the call it is not possible to use the :FILE command to
redirect input for programs using READ. (The only way that input can
be redirected is to use the $STDIN=filename option of the :RUN
command.) Input always comes from the $STDIN file opened by the
session at logon time.
READ differs from READX in how it interprets an end-of-file. READ
reads a record and, if there is a colon in the first column, end-of-file is
set.
Functional Return
transfercount 16-bit signed integer (assigned functional
return)
The length of the ASCII string that was read. If
expectedlength is positive, the count represents
halfwords. If expectedlength is negative, the count
represents bytes.
Parameters
message character array (required)
Returns the ASCII characters that were read. Note
that all character arrays must start on a halfword
boundary.
expectedlength 16-bit signed integer by value (required)