Packed Decimal Practice Exercise
This exercise is intended to help you understand packed decimal arithmetic.
It is not a homework assignment and will not be graded.
You need to write a program.
- Declare some variables:
ABC DC PL3'47'
DEF DC PL2'3'
GHI DC PL5'F'-14'
JKL DC PL3'0'
MNO DS PL3
PQR DC PL6'294'
- First use XDUMP to look at how these variables are stored.
Notice that MNO has not been initialized.
- Do some arithmetic:
ZAP MNO(3),GHI(5)
AP GHI(5),ABC(3)
SP PQR(6),MNO(3)
- Now use XDUMP again to look at the values. Now MNO does
have a value. (We didn't get a Data Exception from the ZAP.)
- Let's try multiplication:
MP PQR(6),DEF(2)
MP GHI(5),ABC(3)
- Again use XDUMP to look at the values.
- Let's try division:
DP PQR(6),ABC(3)
- Check the values again using XDUMP. Notice the locations and
lengths of the quotient and the remainder.