× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Code to move left justified alpha to numeric
  • From: Scott Klement <klemscot@xxxxxxxxxxxx>
  • Date: Tue, 6 Feb 2001 16:33:02 -0600 (CST)


Not only does it assume no decimals and embedded non-numbers, but it also
seems to assume that you want any trailing spaces converted to zeroes...

In other words, if TrzPro is a 12-char alphanumeric (as the
original poster stated), and TrzPro = '       12345'

Your routine would make it become '123450000000'



On Tue, 6 Feb 2001, James Morey wrote:

> Quick-and-Dirty (assumes no decimals or embedded non-numerics):
> 
> c eval TrzPro = %trimR(TrzPro)
> c ' ':'0' xlate TrzPro TrzPro
> 
> c move TrzPro ID#
> 
> 
> 
> 
> ----- Original Message -----
> From: "Art Tostaine, Jr." <art@link400.com>
> To: <midrange-l@midrange.com>
> Sent: Friday, February 02, 2001 10:30 AM
> Subject: Code to move left justified alpha to numeric
> 
> 
> > I have a field called TRZPRO which is defined as 12 char alphanumeric.
> The
> > field contains something like this (periods are spaces)
> >
> > 1234567.....
> >
> > I can have any number of digits and spaces.
> >
> > I want to put that into a 12 digit numeric field called ID#.
> >
> > I came up with this code (WL is a 2 digit numeric field), TRZPROS is
> defined
> > LIKE(TRZPRO)
> >
> > c                   Eval      Wl          = %len(%Trimr(TrzPro))
> > c                   Eval      TrzProS     = '000000000000'
> > c                   Eval      %Subst(TrzPros:13-Wl:wl) = %Trimr(TrzPro)
> > c                   Move      TrzPros       Id#
> >
> > We tried all sorts of things with Triml/trimr, Moves, etc.
> >
> > Is there a better way?
> >
> > Art Tostaine, Jr.
> > CCA, Inc.
> > Jackson, NJ 08527
> >


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.