PROCREAD data [THEN statements] [ELSE statements]
|data||Name of a variable used to receive PROC data from the input buffer.|
The PROCREAD statement reads the results of a PROC from the primary input buffer into the data variable. The MVBasic program must have been called by a procedure for PROCREAD to execute successfully.
The data variable must be simple variable name. It cannot include a system variable, an EQUATE, a dynamic array reference, or a substring reference.
When reading from a PQ PROC, PROCREAD converts the @AM buffer delimiter to a blank space. PROCREAD converts empty buffer entries to the backslash (\) character. PROCWRITE reverses these character conversions. For this reason, including a \ literal in the input buffer should be avoided. When reading from a PQN PROC, PROCREAD does not perform these character conversions.
You can optionally specify a THEN clause, an ELSE clause, or both a THEN and an ELSE clause. If the input buffer read is successful, the THEN clause is executed, even when the contents of the input buffer is the empty string. If input buffer read operation fails, the ELSE clause is executed. If the program containing PROCREAD was not called by a procedure, the read operation fails and the ELSE clause is executed. The statements argument can be the NULL keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line and cannot follow a THEN, ELSE, or END keyword on that line.
D3 and several other emulations support $OPTIONS READ.RETAIN. This option causes the data variable to retain its original value if PROCREAD fails.