Data – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 158

Advertising
background image

Chapter
Statements

11

11 -6

Use the DATA statement to specify the expressions that you can retrieve
with a READ statement (page 11 -31). If you use multiple expressions per
line, you must separate them with a comma.

Every time a READ statement is encountered the next consecutive
expression in the DATA statement is evaluated and assigned to the variable
in the READ statement. You can place DATA statements anywhere within
a program. They are not executed and do not cause an error.
DATA statements are chained and appear as one large DATA statement.
If at anytime all the data is read and you execute another READ statement,
the program terminates and the message

ERROR: NO DATA – IN LINE XX

prints to the console device. The module returns to Command mode.

Important: You cannot use the CHR operator (page 9 -16) in a DATA
statement.

See also RESTORE (page 11 -32)

Syntax

DATA

Example

>LIST

1 REM EXAMPLE PROGRAM

10 DIM A(4)

20 DATA 10,ASC(A),ASC(C),35.627

30 FOR I=0 TO 3

40 READ A(I)

50 NEXT I

60 FOR J=O TO 3

70 PRINT A(J)

80 NEXT J

READY

>RUN

10

65

67

35.627

DATA

Advertising