HP 3000 Manuals

DATA [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

DATA 

The DATA statement lists data for the READ statement.  The data that the
DATA statement provides is assigned to variables by the READ statement.

Syntax 

DATA datum [, datum]...

Parameters 

datum            Numeric or string literal.  A string literal can be
                 enclosed in quotes, but doesn't have to be.  If it is
                 enclosed in quotes it is called a quoted string literal;
                 if not, it is called an unquoted string literal.
                 Leading and trailing spaces are not part of an unquoted
                 string literal, but embedded spaces are.

A DATA statement is not executable.  When the program reaches a DATA
statement, it proceeds to the next line following it.

A data pointer points to the datum that is assigned to the next variable.
Before a program unit is executed, the data pointer is set to point to
the first datum in the program unit's first or lowest-numbered DATA
statement.  The data in a DATA statement are read from left to right.
When all the data in one DATA statement are read, the data pointer is
positioned at the first datum in the next DATA statement.  Within a
program unit, DATA statements are used in line number order.

When one program unit calls another, the data pointer points to the first
data item in the called program unit.  When the called program unit
returns control to the calling program unit, the data pointer returns to
its position in the calling program unit at the time of the call.

Examples 

     10 DATA "2", truffles, "four", A B C, 56

Datum            Description 

"2"              Quoted string literal
truffles         Unquoted string literal
"four"           string literal
A B C            Unquoted string literal
56               Numeric literal

The following program shows the use of the data statement.  It reads, and
then prints three variables.

     >LIST
      !  DATAEX
          10 READ A,B,C$
          20 DATA 1,2,"THREE"
          30 PRINT A
          40 PRINT B
          50 PRINT C$
          60 END
     >RUN
      1
      2
     THREE
     >



MPE/iX 5.0 Documentation