Overview of this example

This subsection explains a conversion example that divides the data of the input file into the records whose values are all normal, and the records that contain an abnormal value for output, which are to be output to separate files.

The figure below describes the file that is input and the file that is output after the conversion in this example.

Figure 8.106 Conversion example (division of output files)

The table below describes the order in which the conversion processing is performed in the example.

Table 8.17 Order of the conversion processing in the example (dividing output files)

Processing order

Processing target record

Processing content

Corresponding relation line

Content

1.

Record 1

1)

From extraction condition 1 to the variables

2.

 

2)

From extraction condition 2 to the output file (normal)

3.

 

3)

From extraction condition 3 to the output file (abnormal)

4.

Record 2

1)

From extraction condition 1 to the output file

5.

 

2)

From extraction condition 2 to the output file (normal)

6.

 

3)

From extraction condition 3 to the output file (abnormal)

7.

Record 3

1)

From extraction condition 1 to the output file

8.

 

2)

From extraction condition 2 to the output file (normal)

9.

 

3)

From extraction condition 3 to the output file (abnormal)

10.

Record 4

1)

From extraction condition 1 to the output file

11.

 

2)

From extraction condition 2 to the output file (normal)

12.

 

3)

From extraction condition 3 to the output file (abnormal)

 

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.17 .

Processing target: Record 1

Employee number

Name

Gender

Department

1000001

Jacob,Smith

1

10

1. According to the functions that have been set, the following values are set for the variables.

Employee number flag

:

Y

(because the employee number in Record 1 is a 7-byte number)

Name flag

:

Y

(because the name in Record 1 does not contain a halfwidth space)

Gender flag

:

Y

(because the gender in Record 1 is "1")

Department flag

:

Y

(because the department in Record 1 is a 2-byte number)

Flag connection

:

YYYY

(values of the employee number flag, name flag, gender flag, and department flag)

judgment flag

:

Y

(because the value of the variable flag connection does not contain an N)

2. The following values are output to the output file (normal)

Employee number

:

1000001

(employee number in Record 1)

Name

:

Jacob,Smith

(name in Record 1)

Gender

:

1

(gender in Record 1)

Department

:

10

(department in Record 1)

 

The following is the content of the output file (normal)

Employee number

Name

Gender

Department

1000001

Jacob,Smith

1

10

3. Because the value of the variable judgment flag is Y, based on the extraction condition 3 (judgment flag =N), no value is output to the output file (abnormal).

Processing target: Record 2

Employee number

Name

Gender

Department

100002

Michael,Johnson

1

20

4. According to the functions that have been set, the following values are set for the variables.

Employee number flag

:

N

(because the employee number in Record 2 is not a 7-byte number)

Name flag

:

Y

(because the name in Record 2 does not contain a halfwidth space)

Gender flag

:

Y

(because the gender in Record 2 is "1")

Department flag

:

Y

(because the department in Record 2 is a 2-byte number)

Flag connection

:

NYYY

(values of the employee number flag, name flag, gender flag, and department flag)

judgment flag

:

N

(because the value of the variable flag connection contains an N)

5. Because the value of the variable judgment flag is N, based on the extraction condition 2 (judgment flag =Y), no value is output to the output file (normal).

6. The following values are output to the output file (abnormal):

Employee number

:

1000002

(employee number in Record 2)

Name

:

Michael,Johnson

(name in Record 2)

Gender

:

1

(gender in Record 2)

Department

:

20

(department in Record 2)

 

The following is the content of the output file (abnormal):

Employee number

Name

Gender

Department

100002

Michael,Johnson

1

20

Processing target: Record 3

Employee number

Name

Gender

Department

1000003

Emily Williams

2

30

7. According to the functions that have been set, the following values are set for the variables.

Employee number flag

:

Y

(because the employee number in Record 3 is a 7-byte number)

Name flag

:

N

(because the name in Record 3 contains a halfwidth space)

Gender flag

:

Y

(because the gender in Record 3 is "2")

Department flag

:

Y

(because the department in Record 3 is a 2-byte number)

Flag connection

:

YNYY

(values of the employee number flag, name flag, gender flag, and department flag)

judgment flag

:

N

(because the value of the variable flag connection contains an N)

8. Because the value of the variable judgment flag is N, based on the extraction condition 2 (judgment flag =Y), no value is output to the output file (normal).

9. The following values are output to the output file (abnormal):

Employee number

:

1000003

(employee number in Record 3)

Name

:

Emily Williams

(name in Record 3)

Gender

:

2

(gender in Record 3)

Department

:

30

(department in Record 3)

 

The following is the content of the output file (abnormal):

Employee number

Name

Gender

Department

100002

Jacob,Smith

1

20

1000003

Emily Williams

2

30

Processing target: Record 4

Employee number

Name

Gender

Department

1000001

Jacob,Smith

1

10

100002

Michael,Johnson

1

20

1000003

Emily Williams

2

30

1000004

Daniel,Brown

3

40

10. According to the functions that have been set, the following values are set for the variables.

Employee number flag

:

Y

(because the employee number in Record 4 is a 7-byte number)

Name flag

:

Y

(because the name in Record 4 does not contain a halfwidth space)

Gender flag

:

N

(gender in Record 4 is not "1" or "2")

Department flag

:

Y

(because the department in Record 4 is a 2-byte number)

Flag connection

:

YYNY

(values of the employee number flag, name flag, gender flag, and department flag)

judgment flag

:

N

(because the value of the variable flag connection contains an N)

11. Because the value of the variable judgment flag is N, based on the extraction condition 2 (judgment flag =Y), no value is output to the output file (normal).

12. The following values are output to the output file (abnormal):

Employee number

:

1000004

(employee number in Record 4)

Name

:

Daniel,Brown

(name in Record 4)

Gender

:

3

(gender in Record 4)

Department

:

40

(department in Record 4)

 

The following is the content of the output file (abnormal):

Employee number

Name

Gender

Department

100002

Michael,Johnson

1

20

1000003

Emily Williams

2

30

1000004

Daniel,Brown

3

40