The EGL move statement copies data, in most cases from the named items in one structure to the same-named items in another.
The effect of the move statement varies by the source type:
Items whose name is an asterisk (*) are not themselves available, but their substructured, named items are available.
When you specify byName and the target is an array of records, the named areas in the source are copied to the same-named areas in successive elements of the target array. The operation is equivalent to a series of move statements, each of which assigns values to another array element.
If the source is an element of an array, the operation moves that element and each subsequent element of the source array to an element in the target array.
Either the source or target array can be longer, and the process ends after data is copied between the last elements for which a match is found.
If the source is not an array, the operation uses the source value to initialize every element in the target array.
Depending on the source type, the operation is equivalent to a series of move statements or a series of assignment statements, as described earlier for source.
count can be any of these:
If the source is an element of an array, the operation moves that element and each subsequent element of the source array to the corresponding target-array element, but only for the number of elements specified in count. The subscripts on the source and target arrays are the starting points for the move. For example, you can specify the following statement:
move source[2] to target[7] for 3;
The previous example moves elements 2, 3, and 4 from source into the elements 7, 8, and 9 in target.
Either the source or target array can be longer, and the process ends after the first of two events occurs:
If the source is not an element of an array, the operation uses the source value to initialize the elements of the target array, beginning with the subscript specified on the target array and continuing for the number of elements specified in count. If the number of elements in the target array exceeds the number in count, the operation initializes all the elements in the target array.
Depending on the source type, the operation is equivalent to a series of move statements or a series of assignment statements, as described earlier for source.
An example is as follows:
move myRecord01 to myRecord02 byName;
Moves are checked for item-to-item compatibility. The rules for truncation, padding, and type conversion are the same as those detailed for the assignment statement.
When you are working with dynamic arrays, the last element in the array is determined by the array's current size. For details, see Arrays.
Related reference
Arrays
Assignments
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.