The matparse statement converts a dynamic array into a dimensioned array.
Syntax
matparse array.var {,start {,end}} from dyn.array.exp {using delimiter} {setting} var array.var = dyn.array.exp |
Parameter(s)
array.var |
References the dimensioned array. |
|
start |
Integer expression that indicates the optional starting position within the array variable to begin updating. If omitted, it defaults to 1. |
|
end |
Integer expression that indicates the optional ending position within the array variable to stop updating. If omitted, it defaults to the array size previously declared with a dim statement for the given array. In all cases, the last array element is assigned all the remaining elements in the dynamic array. |
|
dyn.array.exp |
Data to be used to update the array. |
|
delimiter |
Optional delimiting character within the string used to separate data parsed into the array. If omitted, the default delimiter is an attribute mark (char(254)). The delimiter can be any character between x’00’ and x’fe’, but must be a string. |
|
variable |
Indicates the number of elements of array that were assigned a value, in the form below, each attribute in dyn.array.exp is assigned to an element in array.var.\
|
NOTE |
If the dynamic array contains more elements than the dimensioned array, the remaining elements are put into the last location of the dimensioned array, delimited by attribute marks. |
Example(s)
dim a(10) rec<1> = "test1" rec<2> = "test2" matparse a from rec setting attr.count print a(1) |
Output result would be the following:
test1 |
a = "" a<1> = "larry" a<2> = "moe" a<3> = "curly" dim stooges(4) mat stooges = "unknown"; * initialize stooges = a;* matparse equivalent print stooges(3) : " " : stooges(4) |
Output result would be the following:
curly |
Notice that stooges(4) was null.
See Also