Overview of this example
This subsection explains a conversion example that stores the order IDs of the input data in the variables, then compares the IDs with the values of the previous record to add headers and footers for each order ID.
The figure below describes the file that is input and the file that is output after the conversion in this example.

Figure 8.103 Conversion example (judgment that spans multiple records)
The records are processed in the order set in the mapping. Note that the post-process (relation line 6)) will be performed at the end.
The table below describes the order in which the conversion processing is performed in the example.
Details of the processing are given below. Note that the numbers in the explanations correspond to those in the Processing order column in Table 8.8 .
Processing target: Record 1
OrderID |
Product ID |
Product name |
Quantity |
Unit price |
---|---|---|---|---|
ORDID0001 |
001 |
Product A |
10 |
1000 |
1. The following values are output to the output file:
Type |
: |
HEAD |
(Fixed character string) |
OrderID |
: |
ORDID0001 |
(order ID in Record 1) |
The following is the content of the output file:

2. Because the processing target is Record 1, based on the extraction condition 2 (input record number! =1), no value is output to the output file.
3. Because the processing target is Record 1, based on the extraction condition 3 (input record number! =1), no value is output to the output file.
4. The following value is set to the variable OrderID:
OrderID:ORDID0001 (order ID in Record 1)
5. The following values are output to the output file:
Type |
: |
DATA |
(fixed character string) |
Product ID |
: |
001 |
(Product ID in Record 1) |
Product name |
: |
Product A |
(Product name in Record 1) |
Quantity |
: |
10 |
(quantity in Record 1) |
Unit price |
: |
1000 |
(unit price in Record 1) |
Total |
: |
10×1000=10000 |
("quantity in Record 1" x "unit price in Record 1") |
Processing target: Record 2
OrderID |
Product ID |
Product name |
Quantity |
Unit price |
---|---|---|---|---|
ORDID0001 |
002 |
Product B |
15 |
1200 |
6. Because the processing target is not Record 1, based on the extraction condition 1 (input record numbers =1), no value is output to the output file.
7. Because the order ID in Record 2 and the value of the variable OrderID are both ORDID0001, based on the extraction condition 2 (Field No.1 !=orderID), no value is output to the output file.
8. Because the order ID in Record 2 and the value of the variable OrderID are both ORDID0001, based on the extraction condition 3 (Field No.1 !=orderID), no value is output to the output file.
9. The following value is set to the variable OrderID:
OrderID:ORDID0001 (orderID in Record 2)
10. The following values are output to the output file:
Type |
: |
DATA |
(Fixed character string) |
Product ID |
: |
002 |
(Product ID in Record 2) |
Product name |
: |
Product B |
(Product name in Record 2) |
Quantity |
: |
15 |
(quantity in Record 2) |
Unit price |
: |
1200 |
(unit price in Record 2) |
Total |
: |
15×1200=18000 |
("quantity in Record 2" x "unit price in Record 2") |
The content of the output file is as follows:

Processing target: Record 3
OrderID |
Product ID |
Product name |
Quantity |
Unit price |
---|---|---|---|---|
ORDID0001 |
001 |
Product A |
10 |
1000 |
ORDID0001 |
002 |
Product B |
15 |
1200 |
ORDID0002 |
001 |
Product A |
1 |
1000 |
11. Because the processing target is not Record 1, based on the extraction condition 1 (input record numbers =1), no value is output to the output file.
12. The following values are output to the output file:
Type:TAIL (fixed character string)
The content of the output file is as follows:

13. The following values are output to the output file:
Type |
: |
HEAD |
(fixed character string) |
OrderID |
: |
ORDID0002 |
(orderID in Record 3) |
The content of the output file is as follows:

14. The following value is set to the variable OrderID:
OrderID:ORDID0002 (orderID in Record 3)
15. The following values are output to the output file:
Type |
: |
DATA |
(fixed character string) |
Product ID |
: |
001 |
(Product ID in Record 3) |
Product name |
: |
Product A |
(Product name in Record 3) |
Quantity |
: |
1 |
(quantity in Record 3) |
Unit price |
: |
1000 |
(unit price in Record 3) |
Total |
: |
1×1000=1000 |
("quantity in Record 3" x "unit price in Record 3") |
The content of the output file is as follows:

Processing target: Record 4
OrderID |
Product ID |
Product name |
Quantity |
Unit price |
---|---|---|---|---|
ORDID0002 |
003 |
Product C |
100 |
980 |
16. Because the processing target is not Record 1, based on the extraction condition 1 (input record numbers =1), no value is output to the output file.
17. Because the order ID in Record 4 and the value of the variable OrderID are both ORDID0002, based on the extraction condition 2 (Field No.1 !=order ID), no value is output to the output file.
18. Because the order ID in Record 4 and the value of the variable OrderID are both ORDID0002, based on the extraction condition 3 (Field No.1 !=order ID), no value is output to the output file.
19. The following value is set to the variable OrderID:
OrderID:ORDID0002 (order ID in Record 4)
20. The following values are output to the output file:
Type |
: |
DATA |
(fixed character string) |
Product ID |
: |
003 |
(Product ID in Record 4) |
Product name |
: |
Product C |
(Product name in Record 4) |
Quantity |
: |
100 |
(quantity in Record 4) |
Unit price |
: |
980 |
(unit price in Record 4) |
Total |
: |
100×980=98000 |
("quantity in Record 4" x "unit price in Record 4") |
The content of the output file is as follows:

Post-processing
21. The following values are output to the output file:
Type:TAIL (fixed character string)
The content of the output file is as follows:
