|
Given the following code example:
----------------------------------------------------
D Array S 3A DIM(32767)
D BASED(Array@)
D Variable S 3A BASED(Variable@)
/FREE
Variable@ = %Alloc(%Size(Variable));
Variable = 'XYZ';
Array@ = %Alloc(%Size(Array) * 30);
Array(1) = 'ABC';
dump(a);
*inlr = *on;
return;
/END-FREE
----------------------------------------------------
I get the following output in the dump:
----------------------------------------------------
NAME ATTRIBUTES VALUE
ARRAY CHAR(3) DIM(32767)
(1-32767) NOT ADDRESSABLE
ARRAY@ POINTER SPP:FA6DAE8EB50063B0
VARIABLE CHAR(3) 'XYZ' 'E7E8E9'X
VARIABLE@ POINTER SPP:FA6DAE8EB5006390
----------------------------------------------------
Why are all 32767 elements of the dynamically allocated array not
addressable? I would have expected to see at least the contents of the first
element that had been populated.
This is particularly confusing because the based non-array variable that
also has had memory allocated to it does appear in the dump as I would
expect.
This question has arisen because a colleague has a program with around 15
dynamic arrays like this and it is taking around 15 minutes + to dump the
program, with these results - is the time taken because of these arrays?
Puzzled,
Stu
Stuart Bramley
Senior Technical Developer
Skandia Life::GroupIT
Southampton
t: 023 80 72 64 29 e: stu.bramley@xxxxxxxxxxxxx
IBM Certified Specialist
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.