Deep copy arrays
- Last Updated: December 3, 2025
- 1 minute read
- OpenEdge
- Version 13.0
- 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 or Assignment (=) 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
unsubscripted references to the array objects. 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 without a size to a determinate array. That is, if an array does not yet have a size, you cannot assign it to one that does have a size.
- You can assign any array to an indeterminate array without a size. The size of the indeterminate array is set to the size of the other array.
- You cannot assign a scalar value to an indeterminate array without a size.
For more information, see Work with one-dimensional arrays in Basic ABL.