csci 360
1. 5 points. Assume that you have a packed decimal field DIVIDEND with length 3 and
another DIVISOR with length 1, which are provided as the first and second operands to
a DP instruction, respectively. Describe what happens when the DIVIDEND field contains
the value 50000 (in packed decimal format) and the DIVISOR field contains 2 when the DP
instruction is executed.
2. 5 points. Say that you have a 5-byte packed decimal field that you want to convert and
place in a print buffer with the EDMK instruction. Write a mask that formats values using
leading spaces and include a decimal point to separate the integer component from three
implied decimal places.
3. 5 points. Suppose that the 5-byte packed decimal field in SA question 2 begins at location
0001A5 in storage and contains the value 2345. Give the address placed in R1 by the EDMK
instruction after it is executed.
4. 10 points. Rewrite the following code to use packed decimals in place of the binary RR
and RX instructions and fullword storage declarations. Your packed decimal fields should
only have the absolute minimum lengths required. Assume that all numeric data in the
input buffer is 5-bytes (e.g., F0F0F0F0F5).
LA 2,BUFFER
XREAD BUFFER ,80
READLOOP BNZ EXITREAD
*
LA 4,0 SET ITEM SUBTOTAL ACCUMULATOR
USING $CUSTREC ,2
XDECI 5,$CID
ST 5,CUSTID
XDECI 5,$ITEM1
AR 4,5
XDECI 5,$ITEM2
AR 4,5
XDECI 5,$ITEM3
AR 4,5
XDECI 5,$TAX
DROP 2
AR 5,=F `10000 '
MR 4,4
DR 4,=F `10000 '
ST 5,FNLTOTL
*
XREAD BUFFER ,80
B READLOOP
EXITREAD DS 0H
BR 14
LTORG
BUFFER DS CL80
CUSTID DS F
SUBTOTL DS F
FNLTOTL DS F