Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Size of variable-size arrays – PB Docs 150 – PowerBuilder Library

Size of variable-size arrays – PB Docs 150

Size of variable-size arrays

General information

A variable-size array consists of a variable name followed
by square brackets but no number. PowerBuilder defines the array
elements by use at execution time (subject
only to memory constraints). Only one-dimensional arrays can be variable-size
arrays.

Because you do not declare the size, you cannot use the TO notation
to change the lower bound of the array, so the lower bound of a
variable-size array is always 1.

note.png Using arrays with a TO clause in EAServer components

When you generate a proxy for an EAServer component
deployed from PowerBuilder that contains an array that uses a TO clause,
the proxy object represents the range as a single value because
CORBA IDL does not support the TO clause. For
example, Int ar1[5 TO 10] is
represented as Int ar1[6], with [6] representing
the number of array elements. Client applications must declare the
array using a single value instead of a range.

How memory is allocated

Initializing elements of a variable-size array allocates memory
for those elements. You specify initial values just as you do for
fixed-size arrays, by listing the values in braces. The following
statement sets code[1] equal
to 11, code[2] equal to 242,
and code[3] equal to 27.
The array has a size of 3 initially, but the size will change if
you assign values to higher positions:

For example, these statements declare a variable-size array
and assigns values to three array elements:

When these statements first execute, they allocate memory
as follows:

  • The statement ll_price[100]=2000 will
    allocate memory for 100 long numbers ll_price[1] to ll_price[100],
    then assign 0 (the default for numbers) to ll_price[1] through ll_price[99] and
    assign 2000 to ll_price[100].

  • The statement ll_price[50]=3000 will
    not allocate more memory but will assign the value 3000 to the 50th
    element of the ll_price array.

  • The statement ll_price[110]=5000 will
    allocate memory for 10 more long numbers named ll_price[101] to ll_price[110] and
    then assign 0 (the default for numbers) to ll_price[101] through ll_price[109] and
    assign 5000 to ll_price[110].


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x