DREAD inputlist{,ERR=lineref}


For BBj-specific information, see the DREAD Verb - BBj.

The DREAD verb assigns numeric or string values found in DATA statements to the variables in inputlist.




Variables that will be assigned values from the data read. The syntax and the manner in which it is interpreted are the same as in the READ verb. For example, IOL= is supported. There are two differences in the way DREAD and READ operate:

  • DREAD reads data from DATA statements, while READ takes data from an OPENed channel to a file.

  • If DREAD encounters a data item in single quotes, it is treated as a mnemonic and converted to the same hexadecimal value that PRINT or WRITE would convert the same mnemonic, while the READ verb will not attempt this conversion.


Branch to be taken if an error occurs during execution.

During program execution, PRO/5 keeps a data pointer. For every variable read by a DREAD statement, this pointer is advanced. All DATA statements in a program may be thought of as one long data list. When the last item in a DATA statement is read, the next DREAD automatically advances to the next DATA statement.

Attempting to DREAD past the last data item in the program results in an !ERROR=2 (end-of-file). The data pointer may be set and moved by the RESTORE statement. PRO/5 automatically resets the data pointer to the beginning of the program during BEGIN, END, and when the program is loaded.

An !ERROR=26 may result from trying to DREAD string data into a numeric variable and vice versa. When this or any other error occurs while evaluating a DATA item, the data pointer is not advanced.

DREAD can pick up mnemonics and any expressions that can be printed with a "PRINT" statement. In data statements, you can put arithmetic expressions, such as 2+2, use variables in the program, such as sin(x)), put function calls, such as fnCalc_Total_Sales(tdy_sales,ytd_sales), and string concatenations. The variable that the expression is being read into must be of a type compatible with what the expression returns.

See the DATA and RESTORE verbs for additional information.


1000 RESTORE 6000

6000 DATA 3,'RED','WHITE','BLUE'

See Also

Verbs - Alphabetical Listing