For more information about the GET statement, see GET statement.
If a data list is used, each data-list item must be an element, array, or structure variable. Names cannot be subscripted, but qualified names are allowed in the data list. All names in the stream should appear in the data list; however, the order of the names need not be the same, and the data list can include names that do not appear in the stream.
If the data list contains a name that is not included in the stream, the value of the named variable remains unchanged.
If the stream contains an unrecognizable element-variable or a name that does not have a counterpart in the data list, the NAME condition is raised.
Transmission ends when a semicolon that is not enclosed in quotation marks or an end-of-file is reached. The recognition of the semicolon or end-of-file determines the number of element assignments that are actually transmitted by a particular statement, whether or not a data list is specified.
For example, consider the following data list, where A, B, C, and D are names of element variables:
Data (B, A, C, D)
This data list can be associated with the following input data stream:
A= 2.5, B= .0047, D= 125, Z= 'ABC';
Because C appears in the data list but not in the stream, its value remains unaltered. Z, which is not in the data list, raises the NAME condition.
If the data list includes the name of an array, subscripted references to that array can appear in the stream although subscripted names cannot appear in the data list. The entire array need not appear in the stream; only those elements that actually appear in the stream are assigned. If a subscript is out of range, or is missing, the NAME condition is raised.
For example:
declare X (2,3);
Consider the following data list and input data stream:
Although the data list has only the name of the array, the input stream can contain values for individual elements of the array. In this case, only three elements are assigned; the remainder of the array is unchanged.
If the data list includes the names of structures, minor structures, or structure elements, fully qualified names must appear in the stream, although full qualification is not required in the data list. For example:
dcl 1 In,
2 Partno,
2 Descrp,
2 Price,
3 Retail,
3 Whsl;
If it is desired to read a value for In.Price.Retail, the input data stream must have the following form:
In.Price.Retail=1.23;
The data specification can be any of:
data(In) data(Price) data(In.Price) data(Retail) data(Price.Retail) data(In.Retail) data(In.Price.Retail)