lmayer@elgin.edu

Week 6

DATA statement allows the creation of a sequence of data items to be used by the READ statement

  • Numeric items must be numeric constants, strings follow same rules as for INPUT
  • DATA statements must be in (at the end of) the Main program, not in subprograms
  • Put in a data-sequence holding area in main memory in the same order as in the DATA statements: first line left to right, second line left to right...

READ statements assign specific values to its vaiables from the data sequence formed by the data statements.

  • More than one DATA statement can be used to satisfy a READ statement
  • A program with a READ statement must also have a DATA statement. (Input statements "read" input from the user, while READ statements "read" from the DATA)
  • Numeric variables in a READ statement require numeric constants and string variables require strings.

RESTORE allows the DATA statement to be read more than once (be reread).
It resets the data pointer to the first DATA item.
Perform several different operations on the same set of data.