Op Code (Hex) | Operand 1 | Operand 2 | Operand 3 | |
---|---|---|---|---|
1087 | Receiver | Source | Mask |
Operand 2: Character scalar or data-pointer-defined character scalar.
Operand 3: Character(3) scalar, null, or data-pointer-defined character(3) scalar.
Bound program access |
---|
The receiver_attributes is a structure which describes the data attributes of the receiver values. The format of this structure matches that of the third operand on the CVTCN and CVTNC operations. The source_length parameter contains the length, in bytes, of the source string. It is expected to contain a value between 1 and 32,767. If a value less than 1 or greater than 32,767 is specified, a scalar value invalid (hex 3203) exception is signaled. |
This instruction scans a character string for a valid decimal number in display format, removes the display character, and places the results in the receiver operand. The operation begins by scanning the character string value in the source operand to make sure it is a valid decimal number in display format.
Valid types for the receiver are: packed or zoned decimal, signed or unsigned binary.
The character string defined by source consists of the following optional entries:
The decimal digits may be divided into two parts by the decimal point symbol: an integer part and a fractional part. Digits to the left of the decimal point are interpreted as integer values. Digits to the right are interpreted as a fractional values. If no decimal point symbol is included, the value is interpreted as an integer value. The valid decimal point symbol is determined by mask. If the decimal point symbol precedes the leftmost decimal digit, the digit value is interpreted as a fractional value, and the leftmost decimal digit must be adjacent to the decimal point symbol. If the decimal point follows the rightmost decimal digit, the digit value is interpreted as an integer value, and the rightmost decimal digit must be adjacent to the decimal point.
Decimal digits in the integer portion may optionally have comma symbols separating groups of three digits. The leftmost group may contain one, two, or three decimal digits, and each succeeding group must be preceded by the comma symbol and contain three digits. The comma symbol must be adjacent to a decimal digit on either side. The valid comma symbol is determined by mask.
Decimal digits in the fractional portion may not be separated by commas and must be adjacent to one another.
Examples of external formats follow. The following symbols are used.
$ | currency symbol |
. | decimal point |
, | comma |
D | digit (hex F0-F9) |
blank (hex 40) | |
+ | positive sign |
- | negative sign |
Format | Comments |
---|---|
$+DDDD.DD | Currency symbol, leading sign, no comma separators |
DD,DDD- | Comma symbol, no fraction, trailing sign |
-.DDD | No integer, leading sign |
$DDD,DDD- | No fraction, comma symbol, trailing sign |
$ + DD.DD | Embedded blanks before digits |
Mask must indicate a 3-byte character scalar. Byte 1 of the string indicates the byte value that is to be used for the currency symbol. Byte 2 of the string indicates the byte value to be used for the comma symbol. Byte 3 of the string indicates the byte value to be used for the decimal point symbol. Unpredictable results can occur if the same value is used for more than one symbol. If mask is null for a non-bound program, the currency symbol (hex 5B), comma (hex 6B), and decimal point (hex 4B) are used.
If the syntax rules are violated, a conversion (hex 0C01) exception is signaled. If not, a zoned decimal value is formed from the digits of the display format character string. This number is placed in the receiver operand following the rules of a normal arithmetic conversion.
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.
A data-pointer-defined receiver with 8 byte binary attributes is not supported and will cause a scalar value invalid (hex 3203) exception to be signaled.
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