Hi Frans.
Without the statement DECIMAL-POINT IS COMMA, yes, it should be a dot.
But not in this example where DECIMAL-POINT IS COMMA is stated.
I have also tried without DECIMAL-POINT IS COMMa, then with a dot. Same thing happened.
Mvh. / Regards / Terveisin
Geir
-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Vries, Frans de
Sent: Monday, October 14, 2013 3:35 PM
To: 'COBOL Programming on the IBM i (AS/400 and iSeries)'
Subject: Re: [COBOL400-L] XML using COBOL(RPG)?
All,
The , in 01 ws-a pic x(6) value "-25,33". It should be a dot (.)
Met vriendelijke groet,
Frans de Vries.
-----Oorspronkelijk bericht-----
Van: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] Namens geir.kildal@xxxxxxxxxx
Verzonden: maandag 14 oktober 2013 15:27
Aan: cobol400-l@xxxxxxxxxxxx
Onderwerp: 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.
cobol400-l-bounces@xxxxxxxxxxxx wrote on 10/12/2013 01:00:09 PM:
----- Message from <geir.kildal@xxxxxxxxxx> on Sat, 12 Oct 2013 11:
47:21 +0300 -----
To:
<cobol400-l@xxxxxxxxxxxx>
Subject:
Re: [COBOL400-L] XML using COBOL(RPG)?
Hi.
I'm almost getting it working.
The generation of XML works fine.
The parsing works mostly fine.
However, I do have a problem with numeric values containing
decimals: '325.25' ends up like 325.00 in the receiving field when I
use
'compute NUMFIELD = function numval-c(XML-TEXT)'
NUMFIELD is pic 9(5)v99.
Am I using the wrong function? It works ok with numeric fields
without decimals.
Mvh. / Regards / Terveisin
Geir
--
This is the COBOL Programming on the IBM i (AS/400 and iSeries) (COBOL400-L) mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/cobol400-l.
--
This is the COBOL Programming on the IBM i (AS/400 and iSeries) (COBOL400-L) mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/cobol400-l.
--
This is the COBOL Programming on the IBM i (AS/400 and iSeries) (COBOL400-L) mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/cobol400-l
or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/cobol400-l.
As an Amazon Associate we earn from qualifying purchases.