arr_size
Purpose:
Determine the size of array variable or a particular dimension of the variable.
Enter:
- arr_size <label_root> [dimension_index] [-q] [-h]
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 for quiet output, displaying only the size or -1 on error.
-h
Optional. Specify -h to display help usage and exit.
-
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 returned to the shell is limited to 0 through 255; values greater than 255 are returned as -1. If no dimension index is specified, -1 is returned.
If the actual dimension is greater than 255, a message is displayed on the console and a value of -1 is returned.