UNPK - Unpack Instruction

UNPK - Unpack Instruction - Convert packed decimal to character






Example:    UNPK    CHARACTERFIELD,PACKEDFIELD

Explained:    unpack instruction - location of the converted packed value - location of the original packed value

English:    The format of the second operand is changed from signed packed decimal to zoned and the result is placed at the first operand location

How it works:
 * 1) flips the low order byte
 * 2) unpacks the numeric portion of all the other bytes
 * 3) adds x'F' to the zones of all other bytes
 * 4) pads the result with high order bytes of x'F0'

Princples of Operation Page:    7-238