Convert Character to Numeric (CVTCN)

Instruction Syntax

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

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

  • Char(1)

1 1
  • Scalar length
  • Bin(2)
   
    • If binary:

 

1

1

    • Length (L) (where L = 2 or 4)

      If floating-point:

    • Bits 0-15

1

1

    • Length (L) (where L = 4 or 8)

      If zoned decimal or packed decimal:

    • Bits 0-15

1 1
    • Fractional digits (F)
    • Bits 0-7

1

1

    • Total digits (T)
      (where 1 <= T <= 63 and 0 <= F <= T)

    • Bits 8-15

3

3

  • Reserved (binary 0)

  • Bin(4)

7

7

--- End ---

 

Authorization Required

  • None

Lock Enforcement

  • None

Exceptions

  • 06 Addressing
    • 0601 Space Addressing Violation
    • 0602 Boundary Alignment
    • 0603 Range
    • 0604 External Data Object Not Found
  • 08 Argument/Parameter
    • 0801 Parameter Reference Violation
  • 0C Computation
    • 0C02 Decimal Data
    • 0C06 Floating-Point Overflow
    • 0C07 Floating-Point Underflow
    • 0C09 Floating-Point Invalid Operand
    • 0C0A Size
    • 0C0C Invalid Floating-Point Conversion
    • 0C0D Floating-Point Inexact Result
  • 10 Damage Encountered
    • 1004 System Object Damage State
    • 1044 Partial System Object Damage
  • 1C Machine-Dependent
    • 1C03 Machine Storage Limit Exceeded
  • 20 Machine Support
    • 2002 Machine Check
    • 2003 Function Check
  • 22 Object Access
    • 2201 Object Not Found
    • 2202 Object Destroyed
    • 2203 Object Suspended
    • 2208 Object Compressed
    • 220B Object Not Available
  • 24 Pointer Specification
    • 2401 Pointer Does Not Exist
    • 2402 Pointer Type Invalid
  • 2E Resource Control Limit
    • 2E01 User Profile Storage Limit Exceeded
  • 32 Scalar Specification
    • 3201 Scalar Type Invalid
    • 3202 Scalar Attributes Invalid
    • 3203 Scalar Value Invalid
  • 36 Space Management
    • 3601 Space Extension/Truncation
  • 44 Protection Violation
    • 4401 Object Domain or Hardware Storage Protection Violation
    • 4402 Literal Values Cannot Be Changed