DATA Statement
Stores values for use by subsequent requests for terminal input.
Syntax
DATA data-string{,data-string} ...
Syntax Elements
data-string is any data to be stored to satisfy subsequent requests for input expressed as a variable or symbol name, a numeric literal or a string literal enclosed in quotes.
Each data-string is queued as one line of input. Subsequent requests for input are met on a first-in-first-out basis.
Each data-string is limited in length to 240 characters.
Operation
The DATA statement stores stacked input for use by subsequent INPUT statements in the same or another DataBasic program, or by TCL or English commands when used in conjunction with a CHAIN or PERFORM statement.
Each data string is stored in a data stack separated by an attribute mark from each other data string. The data stack is the same as the Proc secondary output buffer (stack).
The DATA statement cannot be used to supply data for Proc input statements because Proc input statements do not accept data from stacked input.
The DATA statement can be used to feed input requests in the same or another DataBasic program that are executed via a CHAIN, ENTER, or PERFORM statement or a CALLed subroutine. For example:
DATA "RUN BP PROG2",REF.DATE CHAIN 'SSELECT INV WITH DATE < "':REF.DATE:'" BY DATE'
This example exits from a DataBasic program, sort selects a file and begins execution of a second program. The DATA statement stacks two values (RUN BP PROG2 and the value of variable REF.DATE) to be used to feed subsequent requests for terminal input. When the English processor has selected the items, the prompt that follows a SELECT statement will receive RUN BP PROG2 as input. The INPUT statement contained in PROG2 will receive the value of REF.DATE.
A DATA statement must be processed before the CHAIN or PERFORM statement that will use the data.
Do not stack data to be used in a PERFORM statement and then stack data to be used after the PERFORM statement before the PERFORM statement is executed. The TCL processor will process (or attempt to process) every data string in the data stack. The stack is empty when you return to the DataBasic program from a PERFORM statement.
If a variable name appears in a DATA statement, the stacked value is the contents of the variable at the time the DATA statement is executed.
The data stack can be cleared with the CLEARDATA statement.
Examples
X=3 DATA X X=4 CHAIN "RUN BP PGM"
The stacked value is three, because that is the value of X at the time the DATA statement is executed.
DATA X,Y,3 . CHAIN "RUN BP CALC"
Stacks values X, Y and 3 for subsequent requests for input. If CALC has three input requests, they will be satisfied by the values of X, Y and 3.
DATA 'SELECT INV WITH DATE = "' :D: '"' DATA "RUN PROGRAMS ONE", D . ENTER SPEC.LIST
Stacks the English SELECT sentence. Stacks the string RUN PROGRAMS ONE and the value of D. Exits to execute the cataloged program SPEC.LIST.
See Also
INPUT statement, CHAIN statement, ENTER statement, PERFORM statement, CLEARDATA statement.