Map Setup Using Complete Indexes (Complex Example)
The On End extended rule on the SAC segment that was built in the previous section is correct. However, you did not configure the map to reset the child indexes, which caused the improper output.
Resetting Indexes to 1
The TEMP_SAC segment is a child to the SLN segment, so you must reset the Z index to 1 on the On Begin of the SLN group. For example:
Z = 1;
The SLN group is a child to the IT1 group, so you must reset the Y index to 1 on the On Begin of the IT1 group. For example:
Y = 1;
The index used for the IT1 group does not need to be reset, because the IT1 group is the first parent in the nesting of groups. If you did reset the index for the IT1 group, the rule on the SAC segment would overwrite data already written to the TEMP_SAC segment.
Creating the Array
The following table describes how the translator will create the array after you added the rules to reset the Y and Z indexes:
Loop Hierarchical Structure | Occurrence | Data |
---|---|---|
First IT1, First SLN, First TEMP_SAC | 1,1,1 | SAC*S**AB**500.00****EA*20***Service**Service |
First IT1, First SLN, Second TEMP_SAC | 1,1,2 | SAC*S**AB**121.11****EA*10***Service**Service |
First IT1, Second SLN, First TEMP_SAC | 1,2,1 | SAC*S**AB**250****EA*2***Service**Service |
Second IT1, First SLN, First TEMP_SAC | 2,1,1 | SAC*S**AB**45.67****EA*200***Service |
Second IT1, First SLN, Second TEMP_SAC | 2,1,2 | SAC*S**AB**222.74****EA*103.789***Service |
Now you are properly using indexes in the map, and when translation is run, the information from all five SAC segments is received in the Output file, as expected.