Deep copy arrays
- Last Updated: December 3, 2025
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Traditionally, you copy one array to another array using a loop or nested
loops to copy one array element at a time. You can also use an ASSIGN statement to deep copy (clone) one array to another, where it makes
semantic sense to do so. This process copies all elements of one array into memory and then
copies the data to the target array. Therefore, deep copying may not be practical for very
large arrays. For deep copies, use an ASSIGN statement and
unsubscripted references to the array object. For example:
|
When deep copying one array to another, the following rules apply:
- If both the array on the left-hand side and the right-hand
side of the assignment are determinate arrays, the
EXTENTsize must match or the AVM raises an error. - You cannot assign an indeterminate array to a determinate array. That is, if an array does not yet have a fixed size, you cannot assign it to one that does have a fixed size.
- You can assign any array to an indeterminate array and the indeterminate array is fixed at the size of the other array.
- You cannot assign a scalar value to an indeterminate array.
For more information, see the ASSIGN
statement reference entry in ABL Reference.