HPlogo MPE/iX Intrinsics Reference Manual > Chapter 10 Command Definitions (QUIT-ZSIZE)

READ

MPE documents

Complete PDF
Table of Contents
Index

Edition 7 E0701 ♥
Edition 7 E0300
Edition 6 E0195

NM and CM callable.

Reads an ASCII string from $STDIN into an array.

Syntax



  I16             CA       I16V
  length := READ (message, msglength);

Functional Return


length

16-bit signed integer (assigned functional return)

The length of the ASCII string that was read. If msglength is positive, the length specified is in half words; if negative, the length specified is in bytes.

Parameters


message

character array (required)

Returns the ASCII characters that were read.

msglength

16-bit signed integer by value (required)

Returns the length of message. If msglength is positive, it specifies the length in half words; if negative, it specifies the length in bytes. When the record is read, the first msglength characters are input. If msglength is >= record size of message, the entire record is transmitted.


NOTE: Passing a value > message can cause user data corruption or a CCL (1) bounds violation if the system could be corrupted by the call.

Operation Notes


Reads an ASCII string from $STDIN into an array. This is similar to calling the FREAD intrinsic against the file $STDIN. This intrinsic is limited; full capability of the file system is not available. For example, FILE commands are not allowed and some file intrinsics cannot be used because the filenum parameter, obtained from the FOPEN/HPFOPEN intrinsic, is not normally available to users of the READ intrinsic.

Basic line editing, such as cancellation of lines and backspacing, are performed automatically by the I/O driver. If the input device is a terminal in full-duplex mode with the ECHO facility on, or if the terminal is in half-duplex mode, the characters read are printed.

READ interprets the following to be end-of-file (EOF) markers when they begin in the fist column of a record:
  • For sessions, a colon (:).

  • For jobs, a colon (:) or the actual EOF.

When one of these indicators are encountered, CCG (0) is returned and no transfer occurs.

If $STDIN is redirected, only the file's actual EOF is interpreted as the valid EOF indicator.

Condition Codes


CCE (2)Request granted.
CCG (0)Request granted. A record with a colon in the first column, signaling the end-of-data or a hardware end-of-file, was encountered.
CCL (1)Request denied. A physical I/O error occurred. Further error analysis through the FCHECK intrinsic is not possible.

Related Information


Intrinsics READX, PRINT
Manuals Accessing Files Programmer's Guide




QUITPROG


READX