I assume your desired result is x'3456700f'. You know F, the location of the first character of the string. You know L, the length of the string. You know D, the number of decimal digits desired in the result. You can build a constant array of packed values 10, 100, 1000, etc.
Determine if a sign is present. If so, save F in S, decrement L, and increment F. If not, reset S. Determine if a decimal point is present (using TRT?). If so, call its location P. Then N, the number of decimal digits in the string is L-(P-F). Move the N decimal digits one byte to the left (overlaying the decimal point) and decrement L. Update D to D-N. (Dealing with the situation when the decimal point is the last character in the string is left as an exercise for the reader.) Pack the L characters starting at F (using PACK?). Multiply the result by 10^D from the array. If S is set, juggle the sign as appropriate. -----Original Message----- From: IBM Mainframe Assembler List <[email protected]> On Behalf Of Dave Clark Sent: Wednesday, February 16, 2022 6:43 AM To: [email protected] Subject: Interpretting Explicit Decimal Numbers Thanks for all the help so far. Things are looking good. I've reached the point, now, where I need to transform a zoned-decimal number with up to 31 digits of precision and up to 15 digits for scale with an external sign and an explicit decimal point into a packed number that is properly aligned. I can handle the external sign easily enough. But I can only see the long, hard way of handling the explicit decimal -- which is, looping through byte by byte, counting the existing decimal places, padding with zeroes as needed, and removing the explicit decimal point before using PKA to pack and ORing a negative sign if needed. Anybody know any assembler techniques for making this easier? For example, given the following character string as input, what is the easiest way to turn it into a packed number with 4 implied decimal places? -345.67 Finally, to head some of you off at the pass, I can't use vector instructions as I don't have acces to the vector facility. Also, note that the packed work field I'm using for all my decimal conversions is defined as follows. PWORK16 DS PL16 Sincerely, Dave Clark -- int.ext: 91078 direct: (937) 531-6378 home: (937) 751-3300 Winsupply Group Services 3110 Kettering Boulevard Dayton, Ohio 45439 USA (937) 294-5331 **************************************************************************** ***************** This email message and any attachments is for use only by the named addressee(s) and may contain confidential, privileged and/or proprietary information. If you have received this message in error, please immediately notify the sender and delete and destroy the message and all copies. All unauthorized direct or indirect use or disclosure of this message is strictly prohibited. No right to confidentiality or privilege is waived or lost by any error in transmission. **************************************************************************** *****************
