basic.matparse

Statement/BASIC Program, Releases: AP

Converts dynamic array to dimensioned array.

Syntax

matparse array.variable {,start {,end}} from dynamic.array.expression {using delimiter} {setting} variable array.variable = dynamic.array.expression

Description

converts a dynamic array into a dimensioned array.

'array.variable' references the dimensioned array.

'start' is an integer expression which indicates the optional starting position within the 'array.variable' to begin updating. If omitted, it defaults to 1 (one).

'end' is an integer expression which 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 will be assigned all the remaining elements in the dynamic array.

'dynamic.array.expression' is the data to be used to update the array.

'delimiter' is the optional delimiting character within the string to be used to separate data parsed into the array. If omitted, the default delimiter is an attribute mark (char(254)). The 'delimiter' may 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:

array.variable = dynamic.array.expression

Each attribute in 'dynamic.array.expression' is assigned to an element in 'array.variable'.

Example

dim a(10)
rec<1> = 'test1'
rec<2> = 'test2'
matparse a from rec setting attr.count
print a(1)

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)

curly

Notice that stooges(4) was null.

See Also

Command Name Type Description
basic.matbuild Statement Converts dimensioned array to dynamic array.
basic.matread Statement Reads item into dimensioned array.
basic.matwrite Statement Writes dimensioned array to file.
basic.dim Statement Declares a dimensioned array.
basic.array.dimensioned Definition a table where the contents of the elements can be altered (replaced) but the position of each element is fixed.
basic.array.dynamic Definition A string variable delimited by reserved metacharacters.
basic.= Assignment Operator Logical 'equal' operator or variable assignment.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.