SETARRAY /Z bug

x13

Nov 9, 2016
76
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
11,411
99
Syracuse, NY, USA
It doesn't surprise me a bit. /Z shouldn't let you re-dimension (or the help should note the consequences).
 
May 20, 2008
11,411
99
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
76
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.
 
Similar threads
Thread starter Title Forum Replies Date
R Is this a bug in SETARRAY? Support 2
Dmitry L. Kobyakov Fixed The SETARRAY /R command works incorrectly with cyrillic files Support 2
vefatica SETARRAY - /F not honored with /R Support 2
D Documentation SETARRAY and UNSETARRAY ... Support 1
Joe Caverly SETARRAY Maximums Support 2
J WAD setarray "/f" only works on first one Support 1
J WAD "setarray /f" only overwrites the first array var Support 2
T Documentation SETARRAY & SETLOCAL/ENDLOCAL Support 8
S Fixed SETARRAY /R appears not to close the file Support 4
S SETARRAY - minor issue Support 0
Dick Johnson v28 Cosmetic Bug Support 0
Jay Sage WAD Possible Bug With OPTION Command With @FILE Support 5
R strange bug? Support 7
Jay Sage Bug With Flow Control and/or Command Grouping Support 2
M Server 2019 Bug with @execstr? Support 14
R bug _ypixels in BDEBUGGER Support 6
E Fixed Bug with DIR /Z displaying descriptions Support 8
E Text copy bug Support 1
Gamegod ffind bug with chinese Support 2
Dick Johnson cdd - is this a bug or a feature? Support 7
P "Set" command behavior - a bug? Support 3
nikbackm TCC 20 variable expansion bug Support 6
gentzel Bug launching external commands in 20.11.43 Support 11
M Windows Installer bug? Support 4
vefatica @SCRIPT bug persists Support 4
M Little bug, big consequences .. Support 6
fishman@panix.com Once again the Can't Install bug bites... Support 2
gentzel Fixed dirs +n bug in 20.0.12 x64 Support 2
M Bug in Windows 10, when adding symbol to task bar Support 6
Alpengreis [Bug?] View (V) Prefs Error (TC 18.00.27 x64) Support 4
D WAD Minor Post Installation Bug in V18 Support 1
I Possible Bug: History /n Returns Nothing Support 3
samintz WAD Weird REN bug Support 6
Jay Sage WAD Possible Bug in Batch Parameters Support 7
G Bug? TCC 16.03.55 Console Palette Support 4
S Return of FTP copy bug in 16.02.48 Support 12
S XenForo bug Support 3
D TCMD16 Delete Toolbar Button bug Support 7
keithg1964 WAD 16.0027 Alias /rz bug Support 8
rfaquino WAD Apparently a bug when expanding environment variable %ProgramFiles(x86) Support 2
T Documentation @LINE[CON,n] @LINES[CON] not documented (bug?) Support 4
H TIMER bug Support 4
G Fixed @REREPLACE bug Support 15
G WAD PDIR @IF bug, @WORD bug Support 8
T Bug in TCMD but not in TCC Support 8
M WAD A complaint regarding a very irritating TCC installation behavior... (Bug?) Support 4
nickles Renaming bug? Support 9
nickles Redirect bug? Support 4
nickles UrlDecode() bug? Support 3
P WAD Bug in TC v 13.03 build 39 x64 Support 1

Similar threads