It all depends on the application requirements; it the data has been previously edited/verified to ensure that it conforms to the described pattern, then it is most efficient to rely on that verification particularly if the packing routine is heavily used. If the input is directly from a free-form input source, then verification would be needed, either in the routine or preceding it.
Gary Gary Weinhold Senior Application Architect DATAKINETICS | Data Performance & Optimization Phone: +1.613.523.5500 x216<tel:+1.613.523.5500%20x216> Email: [email protected]<mailto:[email protected]> [http://www.dkl.com/wp-content/uploads/2015/07/dkl_logo.png]<http://www.dkl.com/> Visit us online at www.DKL.com<http://www.dkl.com/> [http://www.dkl.com/wp-content/uploads/2015/08/banner.png]<http://www.dkl.com/mailsig> E-mail Notification: The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system. __________ On 2016-10-14 12:02, Steve Smith wrote: Possibly good points, but no one was hired to code a complete solution, and no one has published specifications. He wanted some ideas on how to approach his problem. Chris Webster's technique is nice, as it shows what can be done in these modern times if you've cracked open the PoOp since 1979. sas On Fri, Oct 14, 2016 at 4:55 AM, Tony Thigpen <[email protected]><mailto:[email protected]> wrote: All the examples and comments (so far) don't even come close to what may be needed. The assumption so far has been that the input has exactly 2 numbers after the decimal point and that the number is positive. A true "de-edit" routine needs to take into considerations: 1) The decimal point may or may not exists within the entered data. 2) The number of digits after the decimal point is variable. 3) What type of rounding or truncation is needed if there are too many digits after the decimal point. 4) There may be a "-" (minus sigh) either before or after the number. 5) There are other ways besides a "-" that may indicate that the number is negative. (I.e., "CR" or even a par of "()" characters around the number.) 6) There are different monetary indicators other than the US $ sign. 7) Is there any type of character validation needed? (I.e, what do you do if something other than "0-9,-,+,commna,decimal_point" is found in the data? And those items are just what I can think of off the top of my head. There are sure to be other items to consider. Tony Thigpen Webster, Chris wrote on 10/13/2016 06:30 PM: A modified version for current hardware. The storage references are kept to a minimum. LGHI 11,15 max digits LGHI 15,0 IP010 DS 0H LLGC 1,0(,8) CLIJL 1,C'0',IP020 < zero CLIJH 1,C'9',IP020 > nine NILL 1,15 clear 'F' AGR 15,1 SLLG 15,15,4 ready for next digit JCT 11,IP020 J IP030 too many chars IP020 DS 0H LA R8,1(,R8) next character JCT R9,IP010 IP030 DS 0H AGHI 15,X'C' sign STG 15,0(10) ...chris. -----Original Message----- From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSER V.UGA.EDU] On Behalf Of Ze'ev Atlas Sent: October-13-16 9:41 AM To: [email protected]<mailto:[email protected]> Subject: Re: converting character to packed ClassicWe sould make a.macro out of it :)ZA Sent from Yahoo Mail on Android On Thu, Oct 13, 2016 at 12:17 PM, Richard Rogers< [email protected]<mailto:[email protected]>> wrote: Just a stab, FWIW * R8 ==> INCOMING FIELD * R9 = INCOMING FIELD LENGTH * R10 ==> PL8 PACKED DECIMAL RESULT * R11 = WORK - DIGIT COUNT * R12 ==> CL16 - WORK - SAVE DIGITS INCMPACK DS 0H INCOMING PACK SR R11,R11 DIGIT COUNT LA R12,IPWORK IP010 DS 0H CLI 0(R8),C'0' Q-DIGIT BL IP020 N CLI 0(R8),C'9' INSURANCE - NO CHARS > '9' BH IP020 MVC 0(1,R12),0(R8) SAVE DIGIT LA R11,1(,R11) DIGIT COUNT CH R11,=H'16' Q-TOO MANY DIGITS BNL IP030 Y-HAVE ALL WE CAN HANDLE LA R12,1(,R12) NEXT DIGIT SAVE AREA IP020 DS 0H LA R8,1(,R8) NEXT INCOMING BYTE BCT R9,IP010 IP030 DS 0H BCTR R11,R0 ADJUST FOR 'EX' EX R11,IPPACK * PACK 0(8,R10),IPWORK(*-*) * R10 ==> PL16 PACKED DECIMAL * TTD - EXIT INCOMING PACK ROUTINE, EG, B CONTINUE ON IPPACK PACK 0(8,R10),IPWORK(*-*) IPWORK DS CL16 -----Original Message----- From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSER V.UGA.EDU] On Behalf Of Greg Gray Sent: Thursday, October 13, 2016 08:22 To: [email protected]<mailto:[email protected]> Subject: converting character to packed I have character data in a field (ex. $13,501,298.01) and I need to remove the special characters and convert field from char to packed? Can someone give a suggestion on the best and simplest way to do it, thanks?
