Scale (SCALE)
Instruction Syntax
| Op Code (Hex) | Extender | Operand 1 | Operand 2 | Operand 3 | Operand [4-7] |
|---|---|---|---|---|---|
| SCALE 1063 | Receiver | Source | Scale factor | ||
| SCALEI 1863 | Indicator options | Receiver | Source | Scale factor | Indicator targets |
| SCALEB 1C63 | Branch options | Receiver | Source | Scale factor | Branch targets |
Operand 2: Numeric scalar.
Operand 3: Binary(2) 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] |
|---|---|---|---|---|
| SCALES 1163 | Receiver/Source | Scale factor | ||
| SCALEIS 1963 | Indicator options | Receiver/Source | Scale factor | Indicator targets |
| SCALEBS 1D63 | Branch options | Receiver/Source | Scale factor | Branch targets |
Operand 2: Binary(2) 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.
Description:
The scale instruction performs numeric scaling of the source operand based on the scale factor and places the results in the receiver operand. The numeric operation is as follows:
Operand 1 = Operand 2 *(B**N)where:
- N is the binary integer value of the scale operand. It can be positive, negative, or 0. If N is 0, then the operation simply copies the source operand value into the receiver operand.
- B is the arithmetic base for the type of numeric value in the source operand.
| Base Type | B |
|---|---|
| Binary | 2 |
| Packed/Zoned | 10 |
| Floating-point | 2 |
For a floating-point source operand, the scale operation is performed as if the source operand is multiplied by a floating-point value of 2**N.
If the source and receiver operands have different attributes, the scaling operation is done in an intermediate field with the same attributes as the source operand. If a fixed-point scaling operation causes nonzero digits to be truncated on the left end of the intermediate field, a size (hex 0C0A) exception is signaled. For a floating-point scaling operation, the floating-point overflow (hex 0C06) exception and the floating-point underflow (hex 0C07) exception can be signaled during the calculation of the intermediate result.
The resultant value of the calculation is copied into the receiver 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 receiver operand, aligned at the assumed decimal point of the receiver operand, or both before being copied to it. Length adjustment and decimal point alignment are performed according to the rules of arithmetic operations outlined in Arithmetic Operations. 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 fixed-point receiver fields, if nonzero digits would be truncated from the left end of the resultant value, an invalid floating-point conversion (hex 0C0C) exception is signaled.
For floating-point receiver fields, if the exponent of the resultant value is either too large or too small to be represented in the receiver field, the floating-point overflow (hex 0C06) exception or floating-point underflow (hex 0C07) exception is signaled.
A scalar value invalid (hex 3203) exception is signaled if the value of N is beyond the range of the particular type of the source operand as specified in the following table.
| Source Operand Type | Range of N |
|---|---|
| Signed Binary(2) | -14 <= N <= 14 |
| Unsigned Binary(2) | -15 <= N <= 15 |
| Signed Binary(4) | -30 <= N <= 30 |
| Unsigned Binary(4) | -31 <= N <= 31 |
| Decimal(P,Q) | -31 <= N <= 31 |
For a scale operation in floating-point, no limitations are placed on the values allowed for N other than the implicit limits imposed due to the floating-point overflow and underflow exceptions.
Limitations (Subject to Change)
The following are limits that apply to the functions performed by this instruction.
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 receiver operand is positive.
- Negative–The algebraic value of the receiver operand is negative.
- Zero–The algebraic value of the receiver operand is zero.
- Unordered–The value assigned a floating-point receiver 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
- 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
- 32 Scalar Specification
- 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