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@LISTSERV.UGA.EDU] On 
Behalf Of Ze'ev Atlas
Sent: October-13-16 9:41 AM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
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<rcrogers....@gmail.com> 
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@LISTSERV.UGA.EDU]
On Behalf Of Greg Gray
Sent: Thursday, October 13, 2016 08:22
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
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?



Reply via email to