arr_size
Purpose:
Determine the size of array variable or a particular dimension of the variable.
Enter:
- arr_size <label_root> [dimension_index] [-q]
Where:
-
label_root
Specify the base label of any array variable without any dimensional notation. Example: my_array
dimension_index
Optional. Specify an index number indicating for which dimension the size should be returned.
-q
Optional. Specify -q to display only the size of an array or array dimension.
-
Example:
- arr_size my_array
The above command prints the dimension size of each dimension of the my_array variable in the form:
my_array:A:B:C…
Sizes of each dimension and the number of dimensions are displayed. This returns a -1, since no particular dimension index was specified.
- arr_size my_array 0
- This prints the array size of each dimension as in the previous example but returns the ‘A’ value to the shell.
Notes:
- Note that the printed notation such as my_array:3:3 indicates the maximum size of each dimension, but the variable “my_array:3:3” does not exist since the indices are zero-based and would be numbered 0, 1, 2.
The value of the dimension is returned to the shell. As a result, this value is only available when ‘arr_size’ is spawned from a ’ command script file. In addition, the valid values returned to a shell are limited to values between 0 and 255. Therefore, the -1 that is returned when no dimension index is entered is seen by the shell as 255.
If the actual dimension is greater than 255, a message is displayed on the console and a value of -1 is returned.