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.

Table 8.8 Order of the conversion processing in the example (judgment that spans multiple records)

Processing order

Processing target record

Processing content

Corresponding relation line

Content

1.

Record 1

1)

From extraction condition 1 to the output file

2.

 

2)

From extraction condition 2 to the output file

3.

 

3)

From extraction condition 3 to the output file

4.

 

4)

From extraction condition 4 to the variables

5.

 

5)

From extraction condition 4 to the output file

6.

Record 2

1)

From extraction condition 1 to the output file

7.

 

2)

From extraction condition 2 to the output file

8.

 

3)

From extraction condition 3 to the output file

9.

 

4)

From extraction condition 4 to the variables

10.

 

5)

From extraction condition 4 to the output file

11.

Record 3

6)

From extraction condition 1 to the output file

12.

 

2)

From extraction condition 2 to the output file

13.

 

3)

From extraction condition 3 to the output file

14.

 

4)

From extraction condition 4 to the variables

15.

 

5)

From extraction condition 4 to the output file

16.

Record 4

1)

From extraction condition 1 to the output file

17.

 

2)

From extraction condition 2 to the output file

18.

 

3)

From extraction condition 3 to the output file

19.

 

4)

From extraction condition 4 to the variables

20.

 

5)

From extraction condition 4 to the output file

21.

6)

From post-process 1 to the output file

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: