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



What version of the OS are you at? I've copied your code and it runs fine
on our system at 7.1.

There was a PTF to fix some problems with erroneous values returned from
the NUMVAL function. At V5R4 the PTF was SI35174. It was originally done
for an earlier release, but didn't make it into the code base until 6.1.
We just upgraded from V5R4 to 7.1 and as far as I know, we've had no
problems.j

Our original problem (years ago--circa 2007) was that we had a PL/I
program in the call stack before the COBOL routine. So that just shows
that the environment can affect your results.

Also, keep in mind the manual tells you that conversion from floating
point to fixed-decimal values gives you an approximation of the value.
That's why I suggested trying an interim value with greater precision.
e.g.

WORKING-STORAGE SECTION.
01 ws-result PIC S9(5)V9(5) packed-decimal.
01 ws-b PIC S9(5)V99.
....
PROCEDURE DIVISION.
COMPUTE ws-result = FUNCTION NUMVAL(ws-a).
MOVE ws-result TO ws-b.

If you've got access to SupportLine, they were very helpful when I worked
through this until we isolated the problem.

cobol400-l-bounces@xxxxxxxxxxxx wrote on 10/14/2013 09:35:27 AM:
----- Message from <geir.kildal@xxxxxxxxxx> on Mon, 14 Oct 2013 15:
26:38 +0200 -----

To:

<cobol400-l@xxxxxxxxxxxx>

Subject:

Re: [COBOL400-L] XML using COBOL(RPG)?

Hi Michael.

I have tried computational, comp-3 and binary def for the receiving
field. I still miss the decimals. Here is the essence of my small
testpgm:

WORKING-STORAGE SECTION.
01 ws-a pic x(6) value "-25,33". (SPECIAL NAMES. DECIMAL-
POINT IS COMMA. ( I have also tried without it))
01 ws-b pic s9(5)v9(2) binary value zero. (display, COMP-3,
COMPUTATIONAL - they all fail)

PROCEDURE DIVISION.
mainline section.
main-000.
compute ws-b = function numval-c(ws-a). Result: WS-B = -00025.00
compute ws-b = function numval(ws-a). Result: WS-B = -00025.00
go to main-000.

This is according to the manual, and I just can't understand what
I'm doing wrong..

I'm on V5R4.

Mvh. / Regards / Terveisin

Geir

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.