Combination and division of numeric value data types

When data is extracted from numeric value type data, the numeric value type data is first converted to a decimal number preceded by leading zeros. The converted data is handled as type M. The digits of the numbers to be converted vary depending on the input type. For details, see Notes on digits after a numeric value is converted into character data.

Note

When combining or dividing numeric value type data for output as a numeric value type, make sure that Treat conversion of character strings to numeric values as an error and Treat conversion of numeric values to character strings as an error are not selected in the option settings in the Data Processing Settings screen.

The following explanation assumes that Treat conversion of character strings to numeric values as an error is not selected. Also assumed are that in the input format information, C is specified for Sign (positive) of Output handling in Packed decimal settings, 3 is specified for Zone in Zoned decimal settings, and 5 is specified for Sign (negative) of Output handling.

(1) Division of type B

The following is an example of extracting the 2nd and 3rd bytes from a type B field (2 bytes).

Figure 9.22 Example of dividing numeric value type data (1)

(2) Division of type F

The following is an example of extracting a part of a type F field (4 bytes). For both the integral and decimal parts, when only the numeric part is extracted, the result is treated as an integral part.

Figure 9.23 Example of dividing numeric value type data (2)

(3) Combination of type B (without decimal part)

The following is an example of combining 2 fields of type B data (2 bytes).

Figure 9.24 Example of combining numeric value type data (1)

(4) Combination of type B (with decimal part)

The following is an example of combining 2 fields of type B data (2 bytes). When multiple data items that have decimal parts are combined, because the combined data contains multiple decimal parts, the conversion to a numeric value type results in an error.

Figure 9.25 Example of combining numeric value type data (2)

(5) Combination of type P and type S

The following is an example of combining a type P field (3 bytes) and a type S field (5 bytes). If data that has a negative value is positioned in the 2nd or lower place in the combination order, because the minus sign appears in the middle of the data, the conversion to a numeric value type results in an error. Similarly, an error occurs if more than one minus sign exists in the data.

Figure 9.26 Example of combining numeric value type data (3)

(6) Combination of type 9 and type F

The following is an example of combining a type 9 field (1 byte) and a type F field (4 bytes). Some numeric value type fields result in larger digits when converted to numeric values, and therefore you must be careful about the output size.

Figure 9.27 Example of combining numeric value type data (4)