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



On 18 Mar 2013 14:30, Jeff Young wrote:
I have a character representation of a numeric field whose value
is '0009671180'. This represents 96.71180.

FWiW, IMO far too little is known about the alpha variable and how that value is set\obtained. Most responses given in this thread seem to presume that the specific example given, which alludes but does not explain explicitly, that the character variable will always and only contain 10 zoned _digits_ of the EBCDIC values x'F0' through x'F9'. While Henrik gave an example that is an apparent exception to that presumption, there is no explanation as to why one should expect other possible values to be functional, and what are the bounds for its remaining functional.

Because the builtin shown being used [i.e. %DEC()] supports conversion from a character-string representing a decimal value [which could include sign and decimal point], values other than those like the one provided as an example could be expected to be supported... but how would we know? If for example the value of the character variable was '0096.71180', ¿one might expect that? the division by 100000 might be inappropriate, yet the code could produce a [likely unexpected] result with no error.

If the value is alpha representation of zoned decimal data [e.g. from a DS], then a more appropriate resolution is an [effective] overlay of that data with a zoned decimal variable. That would also ensure that negative values were handled properly. But then, as Gary alludes, the division is unwanted because the type\length attributes of the variable defined in the overlay can implicitly resolve the precision\scale of the data.


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.