Add Numeric (ADDN)

Instruction Syntax

Op Code (Hex) Extender Operand 1 Operand 2 Operand 3 Operand [4-7]
ADDN 1043 Sum Addend Augend
ADDNR 1243 Sum Addend Augend
ADDNI 1843 Indicator options Sum Addend Augend Indicator targets
ADDNIR 1A43 Indicator options Sum Addend Augend Indicator targets
ADDNB 1C43 Branch options Sum Addend Augend Branch targets
ADDNBR 1E43 Branch options Sum Addend Augend Branch targets
Operand 1: Numeric variable scalar.

Operand 2: Numeric scalar.

Operand 3: Numeric scalar.

Operand 4-7:

  • Branch Form–Branch point, instruction pointer, relative instruction number, or absolute instruction number.
  • Indicator Form–Numeric variable scalar or character variable scalar.

Short forms

Op Code (Hex) Extender Operand 1 Operand 2 Operand [3-6]
ADDNS 1143 Sum/Addend Augend
ADDNSR 1343 Sum/Addend Augend
ADDNIS 1943 Indicator options Sum/Addend Augend Indicator targets
ADDNISR 1B43 Indicator options Sum/Addend Augend Indicator targets
ADDNBS 1D43 Branch options Sum/Addend Augend Branch targets
ADDNBSR 1F43 Branch options Sum/Addend Augend Branch targets
Operand 1: Numeric variable scalar.

Operand 2: Numeric scalar.

Operand 3-6:

  • Branch Form–Branch point, instruction pointer, relative instruction number, or absolute instruction number.
  • Indicator Form–Numeric variable scalar or character variable scalar.

Caution

If operands overlap but do not share all of the same bytes, results of operations performed on these operands are not predictable. If overlapped operands share all of the same bytes, the results are predictable when direct addressing is used or whenever the assume coincident operand overlap attribute has been specified in the program template. If the assume coincident operand overlap attribute has not been specified in the program template and indirect addressing is used (that is, based operands, parameters, strings with variable lengths, and arrays with variable subscripts), the results are not always predictable.

Description:

The sum is the result of adding the addend and augend.

Operands can have floating-point, packed or zoned decimal, signed or unsigned binary type.

Source operands are the addend and augend. The receiver operand is the sum.

If operands are not of the same type, addends are converted according to the following rules:

  1. If any one of the operands has floating point type, addends are converted to floating point type.
  2. Otherwise, if any one of the operands has zoned or packed decimal type, addends are converted to packed decimal.
  3. Otherwise, the binary operands are converted to a like type. Note: unsigned binary(2) scalars are logically treated as signed binary(4) scalars.

Addend and augend are added according to their type. Floating point operands are added using floating point addition. Packed decimal addends are added using packed decimal addition. Unsigned binary addition is used with unsigned addends. Signed binary addends are added using two's complement binary addition.

Better performance can be obtained if all operands have the same type. Signed and unsigned binary additions execute faster than either packed decimal or floating point additions.

Decimal operands used in floating-point operations cannot contain more than 15 total digit positions.

For a decimal operation, alignment of the assumed decimal point takes place by padding with 0's on the right end of the addend with lesser precision.

Floating-point addition uses exponent comparison and significand addition. Alignment of the binary point is performed, if necessary, by shifting the significand of the value with the smaller exponent to the right. The exponent is increased by one for each binary digit shifted until the two exponents agree.

The operation uses the lengths and the precision of the source and receiver operands to calculate accurate results. Operations performed in decimal are limited to 31 decimal digits in the intermediate result.

The addition operation is performed according to the rules of algebra.

The result of the operation is copied into the sum operand. If this operand is not the same type as that used in performing the operation, the resultant value is converted to its type. If necessary, the resultant value is adjusted to the length of the sum, aligned at the assumed decimal point of the sum operand, or both before being copied. Length adjustment and decimal point alignment are performed according to the rules of arithmetic operations outlined in the Arithmetic Operations. If nonzero digits are truncated on the left end of the resultant value, a size (hex 0C0A) exception is signaled.

When the target of the instruction is signed or unsigned binary size, exceptions can be suppressed.

For the optional round form of the instruction, specification of a floating-point receiver operand is invalid.

For fixed-point operations, if nonzero digits are truncated off the left end of the resultant value, a size (hex 0C0A) exception is signaled.

For floating-point operations involving a fixed-point receiver field, if nonzero digits would be truncated off the left end of the resultant value, an invalid floating-point conversion (hex 0C0C) exception is signaled.

For a floating-point sum, if the exponent of the resultant value is either too large or too small to be represented in the sum field, the floating-point overflow (hex 0C06) exception and floating-point underflow (hex 0C07) exception are signaled, respectively.

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.

Resultant Conditions

  • Positive - The algebraic value of the numeric scalar sum operand is positive.
  • Negative - The algebraic value of the numeric scalar sum operand is negative.
  • Zero - The algebraic value of the numeric scalar sum operand is zero.
  • Unordered - The value assigned a floating-point sum operand is NaN.

Authorization Required

  • None

Lock Enforcement

  • None

Exceptions

  • 06 Addressing
    • 0601 Space Addressing Violation
    • 0602 Boundary Alignment
    • 0603 Range
  • 08 Argument/Parameter
    • 0801 Parameter Reference Violation
  • 0C Computation
    • 0C02 Decimal Data
    • 0C03 Decimal Point Alignment
    • 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
  • 2C Program Execution
    • 2C04 Branch Target Invalid
  • 2E Resource Control Limit
    • 2E01 User Profile Storage Limit Exceeded
  • 36 Space Management
    • 3601 Space Extension/Truncation
  • 44 Protection Violation
    • 4401 Object Domain or Hardware Storage Protection Violation
    • 4402 Literal Values Cannot Be Changed