MP is a SS2 instruction which is used to multiply packed decimal fields.  Operand 1 is a field in storage which initially contains a packed decimal number representing the multiplicand.  The product develops in this field, destroying the multiplicand.  The contents of Operand 2, another packed decimal field in storage, represents the multiplier.  This field is unchanged by the multiplication (unless it also participates as operand 1).  The condition code is not set by this instruction.


   There are three rules that must be followed concerning the lengths of the fields that participate in a multiply packed instruction.


   1)  The multiplier is limited to a maximum of 8 bytes.


   2)  The multiplicand field can be as large as 16 bytes.


   3)  If the length of operand 2 is “L2”, then the multiplicand must contain at least L2 bytes of leading zeroes before the instruction is executed.


 For example,


               APK      DC    PL4’12345’     = X’0012345C’

               BPK      DC    PL2’100’       = X’100C’


                        MP    APK,BPK


The MP above causes an “0C6” abend because APK contains 1 byte of leading zeroes and BPK is 2 bytes long.  In order to multiply APK and BPK above, we must code a work area that is large enough to support a sufficient number of leading zeroes.  Adding the lengths of both fields we see that a field of length 6 is large enough to prevent this problem.


               WORK     DS    PL6


                        ZAP   WORK,APK

                        MP    WORK,BPK







          Some unrelated MP’s:


 A        DC      P’25645’     = X’25645C’

 B        DC      P’11’        = X’011C’    

 C        DC      P’-4’        = X’4D’

 D        DC      P’9876543’   = X’9876543C’    4 BYTE FIELD

 WORK     DS      PL6



          ZAP   WORK,A      WORK = X’00000025645C’ 3 BYTES LEADING 0’S

          MP    WORK,=P’20’ WORK = X’00000512900C’ 


          ZAP   WORK,B      WORK = X’00000000011C’ 4 BYTES LEADING 0’S 

          MP    WORK,B      WORK = X’00000000121C’ 


          ZAP   WORK,A      WORK = X’00000025645C’ 3 BYTES LEADING 0’S

          MP    WORK,B      WORK = X’00000282095C’ 


          ZAP   WORK,A      WORK = X’00000025645C’ 3 BYTES LEADING 0’S

          MP    WORK,D      ABEND (0C6) - NOT ENOUGH LEADING 0’S


          MP    A,B         ABEND - NOT ENOUGH LEADING 0’S IN “A”



1. When creating a work field for a multiplication, the rule of thumb is to make the work area at least as large as the sum of the fields that contain the multiplicand and the multiplier.  There is no harm in overestimating the size of the work area, but an area that is too small will cause an abend.