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



HI Michael

No I was not responding to your post.

I was responding to the code as written by the OP. I was thinking maybe the >>>>>binary<<<<< shown 5 lines below MIGHT cause the compiler to drop the digits past the decimal point, since BINARY may imply no fractional amounts.


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)



-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of MichaelQuigley@xxxxxxxxxx
Sent: Monday, October 14, 2013 9:26 PM
To: cobol400-l@xxxxxxxxxxxx
Subject: Re: [COBOL400-L] XML using COBOL(RPG)?

Joel,

Not sure if you were responding to my post or not. When I referred to
specifying "PACKED-DECIMAL", "BINARY", etc., I meant using a descriptive
specification rather than as opposed to using COMP-3, COMP-4, etc. which I
would consider somewhat esoteric (i.e., definition meaning "intended to be
revealed only to the initiates of a group"). I guess mentioning BINARY
was extraneous as it wouldn't allow for decimal positions (as you
note--integer values only) which is where Geir is having the
problem--i.e., no decimal being converted.

That could have added confusion to what I'm sure is already a frustrating
problem for him.

Thanks,
Michael

cobol400-l-bounces@xxxxxxxxxxxx wrote on 10/14/2013 01:00:09 PM:
----- Message from "Stone, Joel" <Joel.Stone@xxxxxxxxxx> on Mon, 14
Oct 2013 14:31:24 +0000 -----

To:

"cobol400-l@xxxxxxxxxxxx" <cobol400-l@xxxxxxxxxxxx>

Subject:

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

Not sure if "binary" and decimal s9(5)"v9(2)" makes sense together.

Isnt binary strictly integers (1,2,3...) ? I have never seen
10AC.BD hex before!! - doesn't seem to make sense.

Try removing the "binary" - for testing make it as simple as
possible. Change all to decimal display - not packed, not binary.


-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx [
mailto:cobol400-l-bounces@xxxxxxxxxxxx
] On Behalf Of geir.kildal@xxxxxxxxxx
Sent: Monday, October 14, 2013 8:27 AM
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





-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx [
mailto:cobol400-l-bounces@xxxxxxxxxxxx
] On Behalf Of MichaelQuigley@xxxxxxxxxx
Sent: Monday, October 14, 2013 2:23 PM
To: cobol400-l@xxxxxxxxxxxx
Subject: Re: [COBOL400-L] XML using COBOL(RPG)?

Jon Paris is correct. NUMVAL-C is generally used to convert values
with currency symbols, but I've used it before without them. It should
work.
Where I've often been bit is that NUMVAL and NUMBAL-C both return a
floating point value. Floating point is not precise--at least not
when converted to a fixed-decimal value.

My only suggestion would be to define NUMFIELD as packed-decimal.
You could also try specifying an interim value using greater
precision--at time that helps when converting from floating point
values.

I believe packed-decimal is COMP-3--I prefer specifying"PACKED-
DECIMAL", "BINARY", etc. so that no one is required to remember the
esoteric COMPUTATIONAL identifiers.

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.