Reply

PermalinkRaw Message

Amrith,

Converting a 128-bit unsigned fixed binary integer to packed decimal is not particularly difficult.

The following methodology should meet your needs -

IVFB - Input Value (128-bit Unsigned Fixed Binary)

WVFB - Working Value (128-bit Unsigned Fixed Binary)

AFPD - Adjustment Factor (11-byte Packed Decimal)

QUFB - Quotient (64-bit Unsigned Fixed Binary)

RMFB - Remainder (64-bit Unsigned Fixed Binary)

QUPD - Quotient (11-byte Packed Decimal)

RMPD - Remainder (10-byte Packed Decimal)

OVPD - Output Value (20-byte Packed Decimal)

WVFB = IVFB ;

AFPD = 0 ;

Do While (WVFB >= 100000000000000000000000000000000000000) ; /* (10**38) */

WVFB = (WVFB - 100000000000000000000000000000000000000) ; /* (10**38) */

AFPD = AFPD + 10000000000000000000 ; /* (10**19) */

End ;

Do While (WVFB >= 92233720368547758070000000000000000000) ; /* ((2**63) - 1) * (10**19) */

WVFB = WVFB - 10000000000000000000000000000000000000 ; /* (10**37) */

AFPD = AFPD + 1000000000000000000 ; /* (10**18) */

End ;

QUFB = WVFB / 10000000000000000000 ; /* (10**19) ; Remainder in "RMFB" */

QUPD = QUFB ; /* Convert to Packed Decimal */

RMPD = RMFB ; /* Convert to Packed Decimal */

QUPD = QUPD + AFPD ;

OVPD = QUPD (20 digits)) || RMPD (19 digits) ;

Please note than in the last pseudo-code instruction, the 19 digits of RMPD + the sign field fill ten (10) bytes. However, the sign field of QUPD must be ignored, so an MVO instruction can be used to shift the value one (1) nibble to the left. The QUPD value (after discarding the rightmost byte) can be appended to the front of RMPD, giving you a 30-byte packed decimal value. Please note that a packed decimal field of this length is NOT supported by IBM machine instructions except (I believe) for the ED/EDMK instructions ( I have not tested this).

The logic for converting a signed 128-bit value is slightly more complex, but is also do-able without any significant difficulty.

John P. Baker

-----Original Message-----

From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On Behalf Of Amrith

Sent: Sunday, August 6, 2017 9:49 AM

To: IBM-***@LISTSERV.UA.EDU

Subject: Vector processing instructions

Folks,

Recently I was working with vector processing on z13 and noticed that we have 128bit add and sub instructions but no multiply(correct me here but the multiply is on 64bit) or divide. Any idea on how to convert the 128bit signed/unsigned binary integer to packed decimal. If anyone is working with the vector instructions on z13 please IM me.

Thanks

Amrith

----------------------------------------------------------------------

For IBM-MAIN subscribe / signoff / archive access instructions, send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------

For IBM-MAIN subscribe / signoff / archive access instructions,

send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN