Extended Rule without Indexes (Complex Example)

Add the following On End extended rule to the SAC segment:


IF #0610:2 != 0 THEN
BEGIN
$TEMP_SAC:4.#0248:4 = #0248:3;
$TEMP_SAC:4.#1300:4 = #1300:3;
$TEMP_SAC:4.#0559:10 = #0559:9;
$TEMP_SAC:4.#1301:3 = #1301:2;
$TEMP_SAC:4.#0610:7 = #0610:2;
$TEMP_SAC:4.#0378:3 = #0378:2;
$TEMP_SAC:4.#0332:3 = #0332:2;
$TEMP_SAC:4.#0118:3 = #0118:2;
$TEMP_SAC:4.#0355:61 = #0355:54536;
$TEMP_SAC:4.#0380:15 = #0380:84;
$TEMP_SAC:4.#0380:30 = #0380:168;
$TEMP_SAC:4.#0331:3 = #0331:2;
$TEMP_SAC:4.#0127:29 = #0127:571;
$TEMP_SAC:4.#0770:3 = #0770:2;
$TEMP_SAC:4.#0352:24 = #0352:19;
END

Now, after the translator runs, the Output file contains no data from the SAC segment, but there are five valid SAC segments in the input file. The reason the Output file does not contain the SAC segment information is because the extended rule did not make use of indexes to track the specific occurrence of the TEMP_SAC segment to which it must write the data.

Arrays

A repeating structure is represented internally (in the translator) as an array. An array groups a number of items into a larger unit. The items in an array are accessed by an index number. When you place data into an array, you use an index to make sure that each consecutive occurrence of an array is populated, and thus there will never be an instance of the array that does not contain data, and this prevents data loss.