Packed Decimal Practice Problems
Suppose we have the following defined in storage: NUM1 DC CL3'ABC' NUM2 DC ZL5'-417' PNUM1 DS PL2 PNUM2 DS PL3 PNUM3 DC PL3'5027' PNUM4 DC PL2'200' PNUM5 DS PL6 PNUM6 DC PL5'516437928' LETTER1 DC X'65' LETTER2 DS C LETTER3 DS C
PACK PNUM1(2),NUM1(3)
What are the exact contents of PNUM1 afterward? Write out the answer in hex digits.
PACK PNUM2(3),NUM2(5)
What are the exact contents of PNUM2 afterward? Write out the answer in hex digits.
MP PNUM3(4),PNUM4(2)
ZAP PNUM5(6),PNUM3(3) DP PNUM5(6),PNUM4(2)
What are the exact contents of PNUM5 afterward? Write out the answer in hex digits.
ZAP PNUM2(3),=P'123' CP NUM1(3),PNUM2(3)
ZAP PNUM2(3),=P'3019' SP PNUM2(3),PNUM3(4)
What are the exact contents of PNUM3 afterward? Write out the answer in hex digits.
F9 A7 20 04 8002
Decode the instruction.
SRP PNUM6,3,0
SRP PNUM6,63-3,5
What are the exact contents of PNUM6 afterward?
PACK LETTER2(1),LETTER1(1) UNPK LETTER3(1),LETTER1(1) CLC LETTER2(1),LETTER3
What is now the value of the condition code?
Answers
Here are what are believed to be correct answers. Please point out any that are not correct.
In the answers, we have sign digit 'F' for positive and 'D' for negative, but there are other possibilities.