Previous Topic: Move Array ExamplesNext Topic: Considerations for Date and Time Field Types


Move Array Usage

If you specify the ARR context, in addition to the code required for the *MOVE ARRAY function, CA 2E generates code to define the required array structures. Therefore, you can define these arrays automatically by using the *MOVE ARRAY function. When you generate a *MOVE ARRAY statement, CA 2E generates additional code that checks for array indexing errors.

Multiple instance arrays in 2E are 1-based; the first element in an array is element 1. You cannot specify a constant value (CON context) less than 1 or greater than the maximum number of elements in the array in the Action Diagram Editor. However, if you specify a runtime field value less than 1 or greater than the maximum number of elements in the array in the *Array index field, you receive an error.

If an array indexing error occurs, the PGM.*Return code field is set to a condition value of '*Array index error', which corresponds to the Y2U0068 message in the Y2USRMSG message file. This error can be monitored for as in the following example:

WRK.Product price = ARR.Item Array(WRK.Order line).Item price
.-CASE
¦-PGM.*Return code is *Array index error
¦ <-- *QUIT
'-ENDCASE

If *Result or *Factor 2 is not an array subfield, the following restrictions apply to that field:

If *Result or *Factor 2 is an array subfield then the following restrictions apply to that field.

If *ALL is specified for either *Result or *Factor 2, the following restrictions apply:

Note: The same field type validation rules apply to *MOVE ARRAY as to *MOVE, in terms of moving numeric fields to non-numeric fields.

From the main Action Diagram Editor screen, you can use the subfile option I=M to insert and prompt the *MOVE ARRAY built-in function.