SETARRAY /Z bug

x13

Nov 9, 2016
72
1
Netherlands
Hi all.

I want to load a file into an array, then resize it.

TYPE fruit
banana
pear
cherry
coconut
strawberry
pineapple
orange
pomegranate
kiwi
peach

SETARRAY /R fruit data
SETARRAY data

data[10]

ECHO %@ARRAYINFO[data,5] ** total cells in array **
10

DO x=0 TO 9 (ECHO [%x]: %data[%x])
[0]: banana
[1]: pear
[2]: cherry
[3]: coconut
[4]: strawberry
[5]: pineapple
[6]: orange
[7]: pomegranate
[8]: kiwi
[9]: peach

SETARRAY /Z data[10,3]
SETARRAY data

data[10,3]

ECHO %@ARRAYINFO[data,5] ** total cells in array **
30

DO x=0 TO 9 (DO y=0 TO 2 (ECHO [%x,%y]: %data[%x,%y]))
[0,0]:
[0,1]:
[0,2]:
[1,0]:
[1,1]:
[1,2]:
[2,0]:
[2,1]:
[2,2]:
[3,0]:
[3,1]:
[3,2]:
[4,0]:
[4,1]:
[4,2]:
[5,0]:
[5,1]:
[5,2]:
[6,0]:
[6,1]:
[6,2]:
[7,0]:
[7,1]:
[7,2]:
[8,0]:
[8,1]:
[8,2]:
[9,0]:
[9,1]:
[9,2]:

Data is gone!

So I think there's a bug with SETARRAY /Z because I can add and remove rows and columns in arrays; but as soon as extra dimensions are added, then the array is cleared.

Anyone else can corroborate this?

Mark/x13
 
Last edited:
May 20, 2008
10,618
81
Syracuse, NY, USA
What do you mean Vince?

Seems to me that If the function is there, it should work for all resize operations.

Mark
I think of resizing and redimensioning as very different operations. My first impression (formed without much thought) was that the former was relatively easy and the latter relatively hard. We'll have to wait for Rex to chime in.
 

x13

Nov 9, 2016
72
1
Netherlands
I'm myself a programmer (in another life).

I get what you mean, but I took the /Z option as resizing, that is changing the number of rows/cols without losing data.
I'm sure a new option could be added to do this (i.e. /C(lear)) to erase an array after resizing it.

M.