Formatting a Number with comma's

2013-01-04 Thread Lionel Dyck
I ran across this code from Doug Nadel several years ago and hope that 
y'all will find it useful.


  /* - */
  /* number format code thanks to Doug Nadel   */
  /* - */
   str=strip(translate('0,123,456,789,abc,def', ,
   right(bytes,16,','), ,
   '0123456789abcdef'),'L',',')
   bytes = strip(str)

Here are two examples from oorexx under windows (this works well under 
z/OS and z/VM)

C:\t\new>test.rex 12345678
Bytes: 12,345,678

C:\t\new>test.rex 12345678.12
Bytes: 12,345,678,.12



Lionel B. Dyck <><
z Client Architect
IBM Corporation - West IMT

Mobile Phone: 1-925-207-4518
E-mail: lionel.d...@us.ibm.com
System z: www-03.ibm.com/systems/z/
Linux on z: http://www-03.ibm.com/systems/z/os/linux/
Destination z: http://www-03.ibm.com/systems/z/destinationz/index.html/

"Think Inside the z Box"



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


Formatting a Number with comma's

2013-01-04 Thread Phil Smith
That's "commas", btw.

John McKown wrote:
>  nocommas=strip(input,"b",",")

You meant:
nocommas = space(translate(input, ' ', ','), 0)

That is:

1)  Translate commas to spaces

2)  Remove all spaces from the number

...phsiii


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


Re: Formatting a Number with comma's

2013-01-04 Thread Mark Zelden
On Fri, 4 Jan 2013 10:43:18 -0800, Lionel Dyck  wrote:

>I ran across this code from Doug Nadel several years ago and hope that
>y'all will find it useful.
>
>
>  /* - */
>  /* number format code thanks to Doug Nadel   */
>  /* - */
>   str=strip(translate('0,123,456,789,abc,def', ,
>   right(bytes,16,','), ,
>   '0123456789abcdef'),'L',',')
>   bytes = strip(str)
>
>Here are two examples from oorexx under windows (this works well under
>z/OS and z/VM)
>
>C:\t\new>test.rex 12345678
>Bytes: 12,345,678
>
>C:\t\new>test.rex 12345678.12
>Bytes: 12,345,678,.12
>
>

May need a tweak (or cut/paste does).  What's that extra comma before
the decimal point in the 2nd example?  

There was a recent thread on the TSO-REXX list that had some
nice examples - probably including this one (I don't follow TSO-REXX
too closely).

--
Mark Zelden - Zelden Consulting Services - z/OS, OS/390 and MVS   
mailto:m...@mzelden.com
Mark's MVS Utilities: http://www.mzelden.com/mvsutil.html 
Systems Programming expert at http://expertanswercenter.techtarget.com/

Mark

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


Re: Formatting a Number with comma's

2013-01-04 Thread Lionel Dyck
The 'extra' comman before the .12 on the second example as just that the 
code does not handle numbers with decimal but works well with pure numbers



Lionel B. Dyck <><
z Client Architect
IBM Corporation - West IMT

Mobile Phone: 1-925-207-4518
E-mail: lionel.d...@us.ibm.com
System z: www-03.ibm.com/systems/z/
Linux on z: http://www-03.ibm.com/systems/z/os/linux/
Destination z: http://www-03.ibm.com/systems/z/destinationz/index.html/

"Think Inside the z Box"






From:   Mark Zelden 
To: IBM-MAIN@listserv.ua.edu, 
Date:   01/04/2013 10:54 AM
Subject:    Re: Formatting a Number with comma's
Sent by:IBM Mainframe Discussion List 



On Fri, 4 Jan 2013 10:43:18 -0800, Lionel Dyck  
wrote:

>I ran across this code from Doug Nadel several years ago and hope that
>y'all will find it useful.
>
>
>  /* - */
>  /* number format code thanks to Doug Nadel   */
>  /* - */
>   str=strip(translate('0,123,456,789,abc,def', ,
>   right(bytes,16,','), ,
>   '0123456789abcdef'),'L',',')
>   bytes = strip(str)
>
>Here are two examples from oorexx under windows (this works well under
>z/OS and z/VM)
>
>C:\t\new>test.rex 12345678
>Bytes: 12,345,678
>
>C:\t\new>test.rex 12345678.12
>Bytes: 12,345,678,.12
>
>

May need a tweak (or cut/paste does).  What's that extra comma before
the decimal point in the 2nd example? 

There was a recent thread on the TSO-REXX list that had some
nice examples - probably including this one (I don't follow TSO-REXX
too closely).

--
Mark Zelden - Zelden Consulting Services - z/OS, OS/390 and MVS 
mailto:m...@mzelden.com 
Mark's MVS Utilities: http://www.mzelden.com/mvsutil.html 
Systems Programming expert at http://expertanswercenter.techtarget.com/

Mark

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



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


Re: Formatting a Number with comma's

2013-01-04 Thread Bill Ashton
Now, on a related note...is there a simple way to remove commas from a
number that is input as a string?

For example, if a variable has "2,143,628" in it, how can I easily strip
the commas to wind up with 2143628?

Billy

On Fri, Jan 4, 2013 at 1:58 PM, Lionel Dyck  wrote:

> The 'extra' comman before the .12 on the second example as just that the
> code does not handle numbers with decimal but works well with pure numbers
>
>
>
> Lionel B. Dyck <><
> z Client Architect
> IBM Corporation - West IMT
>
> Mobile Phone: 1-925-207-4518
> E-mail: lionel.d...@us.ibm.com
> System z: www-03.ibm.com/systems/z/
> Linux on z: http://www-03.ibm.com/systems/z/os/linux/
> Destination z: http://www-03.ibm.com/systems/z/destinationz/index.html/
>
> "Think Inside the z Box"
>
>
>
>
>
>
> From:   Mark Zelden 
> To: IBM-MAIN@listserv.ua.edu,
> Date:   01/04/2013 10:54 AM
> Subject:Re: Formatting a Number with comma's
> Sent by:IBM Mainframe Discussion List 
>
>
>
> On Fri, 4 Jan 2013 10:43:18 -0800, Lionel Dyck 
> wrote:
>
> >I ran across this code from Doug Nadel several years ago and hope that
> >y'all will find it useful.
> >
> >
> >  /* - */
> >  /* number format code thanks to Doug Nadel   */
> >  /* - */
> >   str=strip(translate('0,123,456,789,abc,def', ,
> >   right(bytes,16,','), ,
> >   '0123456789abcdef'),'L',',')
> >   bytes = strip(str)
> >
> >Here are two examples from oorexx under windows (this works well under
> >z/OS and z/VM)
> >
> >C:\t\new>test.rex 12345678
> >Bytes: 12,345,678
> >
> >C:\t\new>test.rex 12345678.12
> >Bytes: 12,345,678,.12
> >
> >
>
> May need a tweak (or cut/paste does).  What's that extra comma before
> the decimal point in the 2nd example?
>
> There was a recent thread on the TSO-REXX list that had some
> nice examples - probably including this one (I don't follow TSO-REXX
> too closely).
>
> --
> Mark Zelden - Zelden Consulting Services - z/OS, OS/390 and MVS
> mailto:m...@mzelden.com
> Mark's MVS Utilities: http://www.mzelden.com/mvsutil.html
> Systems Programming expert at http://expertanswercenter.techtarget.com/
>
> Mark
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
>
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>



-- 
Thank you and best regards,
*Billy Ashton*

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


Re: Formatting a Number with comma's

2013-01-04 Thread John McKown
sure

nocommas=strip(input,"b",",")

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A390/4.3.55



On Fri, Jan 4, 2013 at 1:44 PM, Bill Ashton  wrote:
> Now, on a related note...is there a simple way to remove commas from a
> number that is input as a string?
>
> For example, if a variable has "2,143,628" in it, how can I easily strip
> the commas to wind up with 2143628?
>
> Billy
>
> On Fri, Jan 4, 2013 at 1:58 PM, Lionel Dyck  wrote:
>
>> The 'extra' comman before the .12 on the second example as just that the
>> code does not handle numbers with decimal but works well with pure numbers
>>
>>
>>
>> Lionel B. Dyck <><
>> z Client Architect
>> IBM Corporation - West IMT
>>
>> Mobile Phone: 1-925-207-4518
>> E-mail: lionel.d...@us.ibm.com
>> System z: www-03.ibm.com/systems/z/
>> Linux on z: http://www-03.ibm.com/systems/z/os/linux/
>> Destination z: http://www-03.ibm.com/systems/z/destinationz/index.html/
>>
>> "Think Inside the z Box"
>>
>>
>>
>>
>>
>>
>> From:   Mark Zelden 
>> To: IBM-MAIN@listserv.ua.edu,
>> Date:   01/04/2013 10:54 AM
>> Subject:Re: Formatting a Number with comma's
>> Sent by:IBM Mainframe Discussion List 
>>
>>
>>
>> On Fri, 4 Jan 2013 10:43:18 -0800, Lionel Dyck 
>> wrote:
>>
>> >I ran across this code from Doug Nadel several years ago and hope that
>> >y'all will find it useful.
>> >
>> >
>> >  /* - */
>> >  /* number format code thanks to Doug Nadel   */
>> >  /* - */
>> >   str=strip(translate('0,123,456,789,abc,def', ,
>> >   right(bytes,16,','), ,
>> >   '0123456789abcdef'),'L',',')
>> >   bytes = strip(str)
>> >
>> >Here are two examples from oorexx under windows (this works well under
>> >z/OS and z/VM)
>> >
>> >C:\t\new>test.rex 12345678
>> >Bytes: 12,345,678
>> >
>> >C:\t\new>test.rex 12345678.12
>> >Bytes: 12,345,678,.12
>> >
>> >
>>
>> May need a tweak (or cut/paste does).  What's that extra comma before
>> the decimal point in the 2nd example?
>>
>> There was a recent thread on the TSO-REXX list that had some
>> nice examples - probably including this one (I don't follow TSO-REXX
>> too closely).
>>
>> --
>> Mark Zelden - Zelden Consulting Services - z/OS, OS/390 and MVS
>> mailto:m...@mzelden.com
>> Mark's MVS Utilities: http://www.mzelden.com/mvsutil.html
>> Systems Programming expert at http://expertanswercenter.techtarget.com/
>>
>> Mark
>>
>> --
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>
>>
>>
>> --
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>
>
>
>
> --
> Thank you and best regards,
> *Billy Ashton*
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN



-- 
Maranatha! <><
John McKown

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


Re: Formatting a Number with comma's

2013-01-04 Thread Mark Zelden
On Fri, 4 Jan 2013 10:58:57 -0800, Lionel Dyck  wrote:

>The 'extra' comman before the .12 on the second example as just that the
>code does not handle numbers with decimal but works well with pure numbers
>
>

Okay, then if someone needs it to handle decimals also, I suggest looking
on TSO-REXX.  :-)

Mark
--
Mark Zelden - Zelden Consulting Services - z/OS, OS/390 and MVS   
mailto:m...@mzelden.com
Mark's MVS Utilities: http://www.mzelden.com/mvsutil.html 
Systems Programming expert at http://expertanswercenter.techtarget.com/

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


Re: Formatting a Number with comma's

2013-01-04 Thread Phil Smith
For ADDING commas, this works pretty reliably, if a tad obscurely:



/* Call: "AddCommas(12345,',')" */

AddCommas: procedure

   parse arg a '.' +0 d, comma

   a = right(a, ((length(a)+2)%3)*3)

   do i = 1 to (length(a)%3)-1

  a = insert(comma, a, (4*i)-1)

   end

   return strip(a) || d


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


Re: Formatting a Number with comma's

2013-01-04 Thread Roberto Halais
/* rexx */
num = '123,456,789'
num = space(translate(num,'',','),0)
say num

123456789


On Fri, Jan 4, 2013 at 3:48 PM, John McKown wrote:

> sure
>
> nocommas=strip(input,"b",",")
>
> http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A390/4.3.55
>
>
>
> On Fri, Jan 4, 2013 at 1:44 PM, Bill Ashton 
> wrote:
> > Now, on a related note...is there a simple way to remove commas from a
> > number that is input as a string?
> >
> > For example, if a variable has "2,143,628" in it, how can I easily strip
> > the commas to wind up with 2143628?
> >
> > Billy
> >
> > On Fri, Jan 4, 2013 at 1:58 PM, Lionel Dyck 
> wrote:
> >
> >> The 'extra' comman before the .12 on the second example as just that the
> >> code does not handle numbers with decimal but works well with pure
> numbers
> >>
> >>
> >>
> >> Lionel B. Dyck <><
> >> z Client Architect
> >> IBM Corporation - West IMT
> >>
> >> Mobile Phone: 1-925-207-4518
> >> E-mail: lionel.d...@us.ibm.com
> >> System z: www-03.ibm.com/systems/z/
> >> Linux on z: http://www-03.ibm.com/systems/z/os/linux/
> >> Destination z: http://www-03.ibm.com/systems/z/destinationz/index.html/
> >>
> >> "Think Inside the z Box"
> >>
> >>
> >>
> >>
> >>
> >>
> >> From:   Mark Zelden 
> >> To: IBM-MAIN@listserv.ua.edu,
> >> Date:   01/04/2013 10:54 AM
> >> Subject:Re: Formatting a Number with comma's
> >> Sent by:IBM Mainframe Discussion List  >
> >>
> >>
> >>
> >> On Fri, 4 Jan 2013 10:43:18 -0800, Lionel Dyck 
> >> wrote:
> >>
> >> >I ran across this code from Doug Nadel several years ago and hope that
> >> >y'all will find it useful.
> >> >
> >> >
> >> >  /* - */
> >> >  /* number format code thanks to Doug Nadel   */
> >> >  /* - */
> >> >   str=strip(translate('0,123,456,789,abc,def', ,
> >> >   right(bytes,16,','), ,
> >> >   '0123456789abcdef'),'L',',')
> >> >   bytes = strip(str)
> >> >
> >> >Here are two examples from oorexx under windows (this works well under
> >> >z/OS and z/VM)
> >> >
> >> >C:\t\new>test.rex 12345678
> >> >Bytes: 12,345,678
> >> >
> >> >C:\t\new>test.rex 12345678.12
> >> >Bytes: 12,345,678,.12
> >> >
> >> >
> >>
> >> May need a tweak (or cut/paste does).  What's that extra comma before
> >> the decimal point in the 2nd example?
> >>
> >> There was a recent thread on the TSO-REXX list that had some
> >> nice examples - probably including this one (I don't follow TSO-REXX
> >> too closely).
> >>
> >> --
> >> Mark Zelden - Zelden Consulting Services - z/OS, OS/390 and MVS
> >> mailto:m...@mzelden.com
> >> Mark's MVS Utilities: http://www.mzelden.com/mvsutil.html
> >> Systems Programming expert at http://expertanswercenter.techtarget.com/
> >>
> >> Mark
> >>
> >> --
> >> For IBM-MAIN subscribe / signoff / archive access instructions,
> >> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
> >>
> >>
> >>
> >> --
> >> For IBM-MAIN subscribe / signoff / archive access instructions,
> >> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
> >>
> >
> >
> >
> > --
> > Thank you and best regards,
> > *Billy Ashton*
> >
> > --
> > For IBM-MAIN subscribe / signoff / archive access instructions,
> > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
>
>
> --
> Maranatha! <><
> John McKown
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>



-- 
"Men will never be free until the last king is strangled with the entrails
of the last priest." Denis Diderot

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


Re: Formatting a Number with comma's

2013-01-04 Thread Roberto Halais
Will take numbers with decimal point or not.
/* rexx */
bytes = 1234567.89
parse var bytes num '.' dec
num=strip(translate('0,123,456,789,abc,def', ,
  right(num,16,','), ,
  '0123456789abcdef'),'L',',')
bytes = strip(strip(num)||'.'||dec,'T','.')
say bytes

On Fri, Jan 4, 2013 at 4:02 PM, Roberto Halais wrote:

> /* rexx */
> num = '123,456,789'
> num = space(translate(num,'',','),0)
> say num
>
> 123456789
>
>
>
> On Fri, Jan 4, 2013 at 3:48 PM, John McKown 
> wrote:
>
>> sure
>>
>> nocommas=strip(input,"b",",")
>>
>> http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A390/4.3.55
>>
>>
>>
>> On Fri, Jan 4, 2013 at 1:44 PM, Bill Ashton 
>> wrote:
>> > Now, on a related note...is there a simple way to remove commas from a
>> > number that is input as a string?
>> >
>> > For example, if a variable has "2,143,628" in it, how can I easily strip
>> > the commas to wind up with 2143628?
>> >
>> > Billy
>> >
>> > On Fri, Jan 4, 2013 at 1:58 PM, Lionel Dyck 
>> wrote:
>> >
>> >> The 'extra' comman before the .12 on the second example as just that
>> the
>> >> code does not handle numbers with decimal but works well with pure
>> numbers
>> >>
>> >>
>> >>
>> >> Lionel B. Dyck <><
>> >> z Client Architect
>> >> IBM Corporation - West IMT
>> >>
>> >> Mobile Phone: 1-925-207-4518
>> >> E-mail: lionel.d...@us.ibm.com
>> >> System z: www-03.ibm.com/systems/z/
>> >> Linux on z: http://www-03.ibm.com/systems/z/os/linux/
>> >> Destination z:
>> http://www-03.ibm.com/systems/z/destinationz/index.html/
>> >>
>> >> "Think Inside the z Box"
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> From:   Mark Zelden 
>> >> To: IBM-MAIN@listserv.ua.edu,
>> >> Date:   01/04/2013 10:54 AM
>> >> Subject:Re: Formatting a Number with comma's
>> >> Sent by:IBM Mainframe Discussion List <
>> IBM-MAIN@listserv.ua.edu>
>> >>
>> >>
>> >>
>> >> On Fri, 4 Jan 2013 10:43:18 -0800, Lionel Dyck > >
>> >> wrote:
>> >>
>> >> >I ran across this code from Doug Nadel several years ago and hope that
>> >> >y'all will find it useful.
>> >> >
>> >> >
>> >> >  /* - */
>> >> >  /* number format code thanks to Doug Nadel   */
>> >> >  /* - */
>> >> >   str=strip(translate('0,123,456,789,abc,def', ,
>> >> >   right(bytes,16,','), ,
>> >> >   '0123456789abcdef'),'L',',')
>> >> >   bytes = strip(str)
>> >> >
>> >> >Here are two examples from oorexx under windows (this works well under
>> >> >z/OS and z/VM)
>> >> >
>> >> >C:\t\new>test.rex 12345678
>> >> >Bytes: 12,345,678
>> >> >
>> >> >C:\t\new>test.rex 12345678.12
>> >> >Bytes: 12,345,678,.12
>> >> >
>> >> >
>> >>
>> >> May need a tweak (or cut/paste does).  What's that extra comma before
>> >> the decimal point in the 2nd example?
>> >>
>> >> There was a recent thread on the TSO-REXX list that had some
>> >> nice examples - probably including this one (I don't follow TSO-REXX
>> >> too closely).
>> >>
>> >> --
>> >> Mark Zelden - Zelden Consulting Services - z/OS, OS/390 and MVS
>> >> mailto:m...@mzelden.com
>> >> Mark's MVS Utilities: http://www.mzelden.com/mvsutil.html
>> >> Systems Programming expert at
>> http://expertanswercenter.techtarget.com/
>> >>
>> >> Mark
>> >>
>> >> --
>> >> For IBM-MAIN subscribe / signoff / archive access instructions,
>> >> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>> >>
>> >>
>> >>
>> >> --
>> >> For IBM-MAIN subscribe / signoff / archive access instructions,
>> >> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>> >>
>> >
>> >
>> >
>> > --
>> > Thank you and best regards,
>> > *Billy Ashton*
>> >
>> > --
>> > For IBM-MAIN subscribe / signoff / archive access instructions,
>> > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>
>>
>>
>> --
>> Maranatha! <><
>> John McKown
>>
>> --
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>
>
>
>
> --
> "Men will never be free until the last king is strangled with the entrails
> of the last priest." Denis Diderot




-- 
"Men will never be free until the last king is strangled with the entrails
of the last priest." Denis Diderot

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


Re: Formatting a Number with comma's

2013-01-04 Thread Lionel Dyck
Nice simple addition


Lionel B. Dyck <><
z Client Architect
IBM Corporation - West IMT

Mobile Phone: 1-925-207-4518
E-mail: lionel.d...@us.ibm.com
System z: www-03.ibm.com/systems/z/
Linux on z: http://www-03.ibm.com/systems/z/os/linux/
Destination z: http://www-03.ibm.com/systems/z/destinationz/index.html/

"Think Inside the z Box"






From:   Roberto Halais 
To: IBM-MAIN@listserv.ua.edu, 
Date:   01/04/2013 12:13 PM
Subject:        Re: Formatting a Number with comma's
Sent by:IBM Mainframe Discussion List 



Will take numbers with decimal point or not.
/* rexx */
bytes = 1234567.89
parse var bytes num '.' dec
num=strip(translate('0,123,456,789,abc,def', ,
  right(num,16,','), ,
  '0123456789abcdef'),'L',',')
bytes = strip(strip(num)||'.'||dec,'T','.')
say bytes

On Fri, Jan 4, 2013 at 4:02 PM, Roberto Halais 
wrote:

> /* rexx */
> num = '123,456,789'
> num = space(translate(num,'',','),0)
> say num
>
> 123456789
>
>
>
> On Fri, Jan 4, 2013 at 3:48 PM, John McKown 
wrote:
>
>> sure
>>
>> nocommas=strip(input,"b",",")
>>
>> 
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A390/4.3.55
>>
>>
>>
>> On Fri, Jan 4, 2013 at 1:44 PM, Bill Ashton 
>> wrote:
>> > Now, on a related note...is there a simple way to remove commas from 
a
>> > number that is input as a string?
>> >
>> > For example, if a variable has "2,143,628" in it, how can I easily 
strip
>> > the commas to wind up with 2143628?
>> >
>> > Billy
>> >
>> > On Fri, Jan 4, 2013 at 1:58 PM, Lionel Dyck 
>> wrote:
>> >
>> >> The 'extra' comman before the .12 on the second example as just that
>> the
>> >> code does not handle numbers with decimal but works well with pure
>> numbers
>> >>
>> >>
>> >>
>> >> Lionel B. Dyck <><
>> >> z Client Architect
>> >> IBM Corporation - West IMT
>> >>
>> >> Mobile Phone: 1-925-207-4518
>> >> E-mail: lionel.d...@us.ibm.com
>> >> System z: www-03.ibm.com/systems/z/
>> >> Linux on z: http://www-03.ibm.com/systems/z/os/linux/
>> >> Destination z:
>> http://www-03.ibm.com/systems/z/destinationz/index.html/
>> >>
>> >> "Think Inside the z Box"
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> From:   Mark Zelden 
>> >> To: IBM-MAIN@listserv.ua.edu,
>> >> Date:   01/04/2013 10:54 AM
>> >> Subject:Re: Formatting a Number with comma's
>> >> Sent by:IBM Mainframe Discussion List <
>> IBM-MAIN@listserv.ua.edu>
>> >>
>> >>
>> >>
>> >> On Fri, 4 Jan 2013 10:43:18 -0800, Lionel Dyck 
> >
>> >> wrote:
>> >>
>> >> >I ran across this code from Doug Nadel several years ago and hope 
that
>> >> >y'all will find it useful.
>> >> >
>> >> >
>> >> >  /* - 
*/
>> >> >  /* number format code thanks to Doug Nadel */
>> >> >  /* - 
*/
>> >> >   str=strip(translate('0,123,456,789,abc,def', ,
>> >> >   right(bytes,16,','), ,
>> >> >   '0123456789abcdef'),'L',',')
>> >> >   bytes = strip(str)
>> >> >
>> >> >Here are two examples from oorexx under windows (this works well 
under
>> >> >z/OS and z/VM)
>> >> >
>> >> >C:\t\new>test.rex 12345678
>> >> >Bytes: 12,345,678
>> >> >
>> >> >C:\t\new>test.rex 12345678.12
>> >> >Bytes: 12,345,678,.12
>> >> >
>> >> >
>> >>
>> >> May need a tweak (or cut/paste does).  What's that extra comma 
before
>> >> the decimal point in the 2nd example?
>> >>
>> >> There was a recent thread on the TSO-REXX list that had some
>> >> nice examples - probably including this one (I don't follow TSO-REXX
>> >> too closely).
>> >>
>> >> --
>> >> Mark Zelden 

Re: Formatting a Number with comma's

2013-01-04 Thread Mark Zelden
"The Tweak"   :-)

--
Mark Zelden - Zelden Consulting Services - z/OS, OS/390 and MVS   
mailto:m...@mzelden.com
Mark's MVS Utilities: http://www.mzelden.com/mvsutil.html 
Systems Programming expert at http://expertanswercenter.techtarget.com/


On Fri, 4 Jan 2013 16:12:11 -0400, Roberto Halais  
wrote:

>Will take numbers with decimal point or not.
>/* rexx */
>bytes = 1234567.89
>parse var bytes num '.' dec
>num=strip(translate('0,123,456,789,abc,def', ,
>  right(num,16,','), ,
>  '0123456789abcdef'),'L',',')
>bytes = strip(strip(num)||'.'||dec,'T','.')
>say bytes
>
>On Fri, Jan 4, 2013 at 4:02 PM, Roberto Halais wrote:
>
>> /* rexx */
>> num = '123,456,789'
>> num = space(translate(num,'',','),0)
>> say num
>>
>> 123456789
>>
>>
>>
>> On Fri, Jan 4, 2013 at 3:48 PM, John McKown 
>> wrote:
>>
>>> sure
>>>
>>> nocommas=strip(input,"b",",")
>>>
>>> http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A390/4.3.55
>>>
>>>
>>>
>>> On Fri, Jan 4, 2013 at 1:44 PM, Bill Ashton 
>>> wrote:
>>> > Now, on a related note...is there a simple way to remove commas from a
>>> > number that is input as a string?
>>> >
>>> > For example, if a variable has "2,143,628" in it, how can I easily strip
>>> > the commas to wind up with 2143628?
>>> >
>>> > Billy
>>> >
>>> > On Fri, Jan 4, 2013 at 1:58 PM, Lionel Dyck 
>>> wrote:
>>> >
>>> >> The 'extra' comman before the .12 on the second example as just that
>>> the
>>> >> code does not handle numbers with decimal but works well with pure
>>> numbers
>>> >>
>>> >>
>>> >>
>>> >> Lionel B. Dyck <><
>>> >> z Client Architect
>>> >> IBM Corporation - West IMT
>>> >>
>>> >> Mobile Phone: 1-925-207-4518
>>> >> E-mail: lionel.d...@us.ibm.com
>>> >> System z: www-03.ibm.com/systems/z/
>>> >> Linux on z: http://www-03.ibm.com/systems/z/os/linux/
>>> >> Destination z:
>>> http://www-03.ibm.com/systems/z/destinationz/index.html/
>>> >>
>>> >> "Think Inside the z Box"
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> From:   Mark Zelden 
>>> >> To: IBM-MAIN@listserv.ua.edu,
>>> >> Date:   01/04/2013 10:54 AM
>>> >> Subject:Re: Formatting a Number with comma's
>>> >> Sent by:IBM Mainframe Discussion List <
>>> IBM-MAIN@listserv.ua.edu>
>>> >>
>>> >>
>>> >>
>>> >> On Fri, 4 Jan 2013 10:43:18 -0800, Lionel Dyck >> >
>>> >> wrote:
>>> >>
>>> >> >I ran across this code from Doug Nadel several years ago and hope that
>>> >> >y'all will find it useful.
>>> >> >
>>> >> >
>>> >> >  /* - */
>>> >> >  /* number format code thanks to Doug Nadel   */
>>> >> >  /* - */
>>> >> >   str=strip(translate('0,123,456,789,abc,def', ,
>>> >> >   right(bytes,16,','), ,
>>> >> >   '0123456789abcdef'),'L',',')
>>> >> >   bytes = strip(str)
>>> >> >
>>> >> >Here are two examples from oorexx under windows (this works well under
>>> >> >z/OS and z/VM)
>>> >> >
>>> >> >C:\t\new>test.rex 12345678
>>> >> >Bytes: 12,345,678
>>> >> >
>>> >> >C:\t\new>test.rex 12345678.12
>>> >> >Bytes: 12,345,678,.12
>>> >> >
>>> >> >
>>> >>
>>> >> May need a tweak (or cut/paste does).  What's that extra comma before
>>> >> the decimal point in the 2nd example?
>>> >>
>>> >

Re: Formatting a Number with comma's

2013-01-04 Thread John Gilmore
Perhaps another point of view will be of some interest.

The schemes presented in this thread seem to me to be examples of
radically misplaced ingenuity.  If I did not know better I should be
forced to conclude from them that knowledge of HLASM programming had
been lost to this list.

Chapter 8 (Decimal Instructions) of the current PrOp contains full
discussions of the EDIT and EDIT AND MARK machine instructions, which
perform these operations elegantly, efficiently, and compactly.

John Gilmore, Ashland, MA 01721 - USA

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


Re: Formatting a Number with comma's

2013-01-04 Thread Shane Ginnane
On Fri, 4 Jan 2013 16:02:58 -0500, John Gilmore wrote:

>Perhaps another point of view will be of some interest.

What the hell, here's another ...
 ... too early in the year for language flames-wars ...  ;-)

Shane ...

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


Re: Formatting a Number with comma's

2013-01-04 Thread Gerhard Postpischil

On 1/4/2013 4:02 PM, John Gilmore wrote:

Chapter 8 (Decimal Instructions) of the current PrOp contains full
discussions of the EDIT and EDIT AND MARK machine instructions, which
perform these operations elegantly, efficiently, and compactly.


The OP asked for a way to remove commas from an EBCDIC "numeric" string; 
I see no way of using ED or EDMK to do this. The second question raised, 
of inserting commas, may have a model dependent answer. It's not clear 
whether packing a variable length number, then  editing that would be 
faster than a translate after moving to a work area with pre- or 
post-fixed blank and comma.


Gerhard Postpischil
Bradford, Vermont

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