that valid numeric characters (or a sign) exist. The
first byte position processed in the sending field
merely has its half bytes transposed and sent to the
receiving (packed) field. Each successive byte in
the sending field has its zone portion stripped and
the numeric portion forms successive half-bytes in
the packed field.
UNPACK INSTRUCTION (UNPK)
The unpacking operation is the reverse of the pack-
The first byte in the sending (packed) field is pro-
cessed by having its zone (sign) and numeric por-
tions reversed and sent to the receiving (unpacked)
Each successive half-byte in the packed field forms
a byte in the unpacked field with a zone portion of
F16 (1111)2 being generated by hardware during
execution of the instruction.
As an example of the Unpack instruction assume that
it is desired to print a balance field as a part of an
The balance field is a packed field that has accumu-
lated the transaction amounts. Assume it is in pack-
ed format and contains the following value:
An area for printing the balance field has been al-
located as follows:
The instruction as shown below would unpack BAL
with the result in the field PBAL.
General Register one contains 0000
General Register two contains 4096
37 38 39 40 41 42 43
FO FO F1 F7 F2 F4 S3
The receiving (unpacked) field can be considered the
controlling field. If it is larger than necessary,
high-order bytes are filled with the numeric charac-
ter zero FOI6.
If it is not large enough to receive all digits in the
sending (packed) field, the high-order digit(s) of the
sending field are truncated.
To determine the size of the unpacked field necessary
to receive the digits in a packed field, the size (in
bytes) of the packed field should be doubled and one
should be subtracted for determining the number of
Assume that the following allocations have been
and that the allocated areas contain the hexadecimal
values as shown below:
00 01 02 03 04 05 06 07 08 09 10 11 12
FO Fl F2 F5 C7 FO C3
50 51 52 53 54 55 56 57 58 59 60 61 62
00 24 5C
Answer each of the following questions by writing the
assembly instruction in the space provided and show-
ing the result of the instruction in the blank locations
Pack 'BAL' in 'WBAL'
Unpack 'DATA' in 'WDATA'