Fields within arrays or repeating groups can be qualified using the group item with the field name.
A field that is a child of a group item may be specified as group_item.field_name, where group_name is the name of the group item and field_name is the name of the field.
If the group_item is an array (repeating group); each cell of the array can be specified using an index_value between the group item name and the field name.
Example 1
Given the following COBOL description that contains two (2) group items. GROUP_1 is a non-repeating group item and GROUP_2 is an array or repeating group.
05 GROUP_1.
10 FIELD1A PIC X(5).
10 FIELD1B PIC X(3).
05 GROUP_2 OCCURS 5 TIMES.
10 FIELD2A PIC X(5).
10 FIELD2B PIC X(3).
Example 2
How to specify fields within group item GROUP_1.
PROCESS INTO DS_OUT
SELECT
{
DS_OUT.FIELDA = GROUP1.FIELD1A
DS_OUT.FIELDB = GROUP1.FIELD1A
}
FROM DS_IN;
Example 3
This example shows how to specify fields within the second cell (occurrence) of group item GROUP_2, which is an array or repeating group.
PROCESS INTO DS_OUT
SELECT
{
DS_OUT.FIELDA = GROUP2.2.FIELD2A
DS_OUT.FIELDB = GROUP2.2.FIELD2B
}
FROM DS_IN;