
The Convert to Decimal instruction takes a 2’s complement
integer from a register and converts it to packed decimal data in memory. Operand 1 designates a register containing
the 2’s complement integer. Operand 2
represents a doubleword storage area in memory where the packed decimal data
will be placed.
CVD can convert any
2’s complement integer which is contained in a register. This includes all integers in the range
-2,147,483,648 and +2,147,483,647.
Since the result is placed in an 8 byte field (doubleword), no overflow
can occur since there is ample room in Operand 2.
In the following example, register 5 is converted to packed
decimal and placed in a doubleword. The result can be moved to a smaller field
if the programmer is sure it will fit.
CVD R5,DOUBWORD CHANGE IT TO PACKED DECIMAL
ZAP XPACK,DOUBWORD DATA WILL FIT IN 10 BYTES
...
XPACK DS PL10
DOUBWORD DS D
First the integer in register 5 is converted to packed decimal
and placed in a doubleword in memory.
Since the doubleword contains at most 10 decimal digits ( it was
converted from a single register ), it can be transferred to XPACK with ZAP.
The diagram below illustrates the relationship between CVD and other data conversion
instructions for some common data types.

Some Unrelated CVD Instructions
R7 =
X’00000000’ = 0
R8
= X’0000001F’ = 31
R9
= X’FFFFFFFF’ = -1
R10 = X’00001000’ = 4096
DOUBWORD
DS D
CVD R7,DOUBWORD DOUBWORD =
X’000000000000000C’
CVD R8,DOUBWORD DOUBWORD =
X’000000000000031C’
CVD R9,DOUBWORD DOUBWORD =
X’000000000000001D’
CVD R10,DOUBWORD DOUBWORD =
X’000000000004096C’