× 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.



Scott,

1)  Since the data is keyed into a spreadsheet, it is too likely that alpha
data will show up.  In that case my procedure is just returning the
existing string intact.  The return value is defined as 32A.  I'm leaving
it to the calling program to dedecide what to do with invalid data.

 Since I'm returning an alpha string, I want to place the proper number of
digits in the return field.  So the idea was to be able to handle it
something like this:

ReturnData = EditC( %DecH( AtoF( InputString ) :VaryingLength: DecLength
):'X' )
 
 This won't work, since VaryingLength and DecLength would not be known at
compile time.

 Of course, I can handle it w/ %SubStr(), but I think that being able use
the combination of defining the numric size of the fly and then using an
edit code is MUCH more elegant.

 BTW, in 5.2 %DecH seems to only handle up to 30 positions, not 31.  I
wonder why.


2)  The data is originally keyed into Excel, but gets saved as tab
delimited text.  So if they forget to reformat the column (that Excel
automatically displays as scientic notation) and save the file, the real
number does not get saved.  Very annoying behavior.


3)  I was hoping to avoid an MI built-in, but if all else fails I guess I
could use LBCPYNV.

 -mark


Original Message:
-----------------
From: Scott Klement rpg400-l@xxxxxxxxxxxxxxxx
Date: Wed, 20 Oct 2004 23:44:36 -0500 (CDT)
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Converting from scientific to integer/decimal



>   I actually had decided on using %DecH().  The business application is
> data originally coming from an Excel spreadsheet.  I wanted to make a
> generic routine (*Module in a *SRVPGM) out of this conversion.   Since I
> don't know ahead of time what the length being passed might be, I was
> hoping that %Dec and %DecH might allow a runtime value to be used as the
> length (2nd parm in the BIF), but unfortunately, that value must be
> available at compile time.

I guess I don't understand.  Why does the length on the %DEC() or %DECH()
need to be variable?  Can't you have it return a 31P 9 (or something like
that) and then let the programmer assign it to any numeric field he
pleases?

If the data is in an Excel spreadsheet, why are you extracting it from a
character string?  Last I checked, Excel stores numbers in 8F format, all
you'd need to do is an assignment.

If nothing else, couldn't you use LBCPYNV to convert the field from one
format to another?

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.