System Functions
DIM( ) Generate String/Get Array Size
   
Formats 1. Generate or Initialize String: DIM(len[,fill$][,ERR=stmtref] )
2.
Read Total elements in Array: DIM(READ NUM(array_name[$][,subscript] ) )
3.
Get maximum index for an Array: DIM(READ MAX(array_name[$][,subscript] ) )
4.
Get minimum index for an Array: DIM(READ MIN(array_name[$][,subscript] ) )
5.
Find max/min value in Array: DIM(FIND [ MIN | MAX ] ( array_name[$] ) )
6.
Scan array for value: DIM(FIND array_name[$] comparision value[$] )
7.
Total numeric array: DIM(ADD array_name)
8.
Return associated index: DIM(INDEX ADD array_name[$] [ keyword$ ] )

Formats 5, 6, 7, and 8 are +PxPlus Exclusive (format 8 build 9200)

Where:

array_name[$] Name of a previously dimensioned array.
fill$ Text string or value which will be used to fill the variable up to the length specified. String expression.
len Desired length of the string variable. Numeric expression, integer.
stmtref Program line number or statement label to which to transfer control.
subscript Array's dimensions (first, second, or third).
comparision Type of comparision to be done against each element of the array.
value[$] Value to compare each element against. Type of value must match the type of array (string value for string arrays, numeric values for numeric array)
keyword$ Keyword associated with the element in the array whose index is to be returned.
   
Returns Initialized string, or information about dimensions of array.
   
Description Use the DIM( ) function to generate or initialize a string. You can also use it to obtain information about the size of an array you have already defined using the DIM directive.
   
Format 1 Generate or Initialize String
 
DIM(len[,fill$][,ERR=stmtref])
 
Use this format to generate or initialize a string whose length you specify. The function fills the string by using the value for fill$.


*Note* This format of the function behaves almost like the DIM directive's format to initialize strings. However, instead of repeating only the first character of the string, as in the directive, the function repeats the complete value of the fill string. (Refer to the DIM Directive, for the format to initialize strings).


  If you omit the fill string, ProvideX uses spaces as fill characters; e.g.,
 
0100 PRINT ":",DIM(11,"*Cat"),":"
->RUN
*Cat*Cat*Ca:
 
0100 PRINT 'CS',"A Title",@(0,1),DIM(80,"-")
0110 REM The DIM( ) above returns a string of hyphens "-" 80 characters long
->RUN A Title
-------------------- ... etc.
   
See Also '+S' & '-S' Mnemonics.
   
Formats 2,3,4 Read Dimensions (Size) of Array
 
Use Formats 2, 3, and 4 of the DIM( ) function (listed below) to read a given array's total number of elements, the minimum element's number and the maximum element's number. If the variable you specify is not an array, NUM and MIN will return 0, MAX will return -1.
 
DIM(READ NUM(array_name[$][,subscript]))
Use the DIM(READ NUM( )) function to read the total number of elements in a dimensioned array; e.g.,
 
0100 DIM X[0:15]
0110 PRINT DIM(READ NUM(X))
->run
 16
   
DIM(READ MAX(array_name[$][,subscript]))
Use the DIM(READ MAX( )) function to read the maximum element number in a dimensioned array; e.g.,
 
0110 DIM X[0:15]
0120 PRINT DIM(READ MAX(X))
->run
 15
   
DIM(READ MIN(array_name[$][,subscript]))
Use the DIM(READ MIN( )) function to read the minimum element number in a dimensioned array; e.g.,
 
0110 DIM X[0:15]
0120 PRINT DIM(READ MIN(X))
->run
 0
Format 5 Find max/min value in Array
+PxPlus Exclusive

You can use this format of the DIM function to scan an array to determine the index of the highest or lowest element. The return value will be the index into the array.

For Example: Assuming an array X$ contained 'Cat', 'Dog', 'Zebra', 'Ant', 'Pig' in elements 1 thru 5,

DIM (FIND MAX(X$)) this would yield 3 (for Zebra)
DIM (FIND MIN(X$)) this would yield 4 (for Ant)
   
Format 6 Scan array for value
+PxPlus Exclusive

You can use this format of the DIM function to locate a value in an array that will match a expression. The return value will be the index into the array.

For Example: Assuming an array X$ contained 'Cat', 'Dog', 'Zebra', 'Ant', 'Pig' in elements 1 thru 5,

DIM (FIND X$ = "Dog" this would yield 2
DIM (FIND X$ > "Man") this would yield 3 (for Zebra)
   
Format 7 Total numeric array
+PxPlus Exclusive

The DIM (ADD X) format can be used to quickly total a numeric array.

Format 8 Lookup and return index for given keyword
+PxPlus Exclusive (build 9200)

The DIM (INDEX xxx["keyword"] ) format can be used against any associative array in order to return the index of the element for the specified keyword. If no element with the specified keyword is found the return value will be zero.