Convert Character to Numeric (CVTCN)


Op Code (Hex) Operand 1 Operand 2 Operand 3
1083 Receiver Source Attributes

Operand 1: Numeric variable scalar or data-pointer-defined numeric scalar.

Operand 2: Character scalar or data-pointer-defined character scalar.

Operand 3: Character(7) scalar or data-pointer-defined character scalar.

Description

The character scalar specified by operand 2 is treated as though it were a numeric scalar with the attributes specified by operand 3. The character string source operand is converted to the numeric forms of the receiver operand and moved to the receiver operand. The value of operand 2, when viewed in this manner, is converted to the type, length, and precision of the numeric receiver, operand 1, following the rules for the Copy Numeric Value (CPYNV) instruction.

The length of operand 2 must be large enough to contain the numeric value described by operand 3. If it is not large enough, a scalar value invalid  (hex 3203) exception is signaled. If it is larger than needed, its leftmost bytes are used as the value, and the rightmost bytes are ignored.

Normal rules of arithmetic conversion apply except for the following. If operand 2 is interpreted as a zoned decimal value, a value of hex 40 in the rightmost byte referenced in the conversion is treated as a positive sign and a zero digit.

If a decimal to binary conversion causes a size  (hex 0C0A) exception to be signaled, the binary value contains the correct truncated result only if the decimal value contains 15 or fewer significant nonfractional digits.

The format of the attributes operand specified by operand 3 is as follows:

Offset
Dec Hex
Field Name
Data Type and Length
0 0
Scalar attributes
Char(7)
0 0
Scalar type
Char(1)



Hex 00 = Signed binary
Hex 01 = Floating-point
Hex 02 = Zoned decimal
Hex 03 = Packed decimal
Hex 0A = Unsigned binary


1 1
Scalar length
Bin(2)









If binary:



1 1
Length (L) (where L = 2 or 4)
Bits 0-15



If floating-point:



1 1
Length (L) (where L = 4 or 8)
Bits 0-15



If zoned decimal or packed decimal:



1 1
Fractional digits (F)
Bits 0-7
1 1
Total digits (T)
Bits 8-15



(where 1 <= T <= 63 and 0 <= F <= T)


3 3
Reserved (binary 0)
Bin(4)






7 7
--- End ---

Authorization Required

Lock Enforcement

Exceptions

06 Addressing

08 Argument/Parameter

0C Computation

10 Damage Encountered

1C Machine-Dependent

20 Machine Support

22 Object Access

24 Pointer Specification

2E Resource Control Limit

32 Scalar Specification

36 Space Management

44 Protection Violation