View previous topic :: View next topic
|
Author |
Message |
aedesy
New User
Joined: 11 Feb 2022 Posts: 6 Location: ITALY
|
|
|
|
Hi,
I have a CSV input file. I read it with UNSTRING. I am trying to move some alphanumeric fields to numeric fields by using FUNCTION NUMVAL.
Here is an example:
Input record:
Code: |
...12/01/2020;300.000;... |
'300.000' is stored into WK-IMPORTO.
COBOL code:
Code: |
...
05 INCC-IMPORTO PIC 9(13)V999.
...
01 WK-IMPORTO PIC X(16).
...
COMPUTE INCC-IMPORTO = FUNCTION NUMVAL(WK-IMPORTO) |
I get this error:
'IGZ0152S Invalid character . was found in column 4 in argument-1 for function NUMVAL...'.
I also tried with INSPECT, replacing '.' with ',' but same error. But it works with OpenCOBOL. I really did not understand. Could someone explain? Thanks in advance. |
|
Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8624 Location: Dubuque, Iowa, USA
|
|
|
|
With what you've posted, it looks like it should work. However, some questions do come up:
- What release of the compiler are you using?
- What does a DISPLAY of WK-IMPORTO just before the COMPUTE statement show?
Broadly speaking, the computer is telling you that the fourth character of your WK-IMPORTO variable is not valid for NUMVAL. So you need to take a very close look at that variable's value to determine why the computer made that determination.
Oh, and it doesn't matter what OPENCOBOL did with the statement -- unless you don't want to use Enterprise COBOL for this program. |
|
Back to top |
|
 |
aedesy
New User
Joined: 11 Feb 2022 Posts: 6 Location: ITALY
|
|
|
|
Hi, thanks for your answer. The DISPLAY of the field is showing '300.000' and the release of compiler is '5655-EC6'. I tried to use HEX ON for help:
Code: |
24/05/2019;300.000;
FF6FF6FFFF5FFF4FFF5
2410512019E300B000E |
I don't see any particular issue. |
|
Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10824 Location: italy
|
|
|
|
IMO there is a misunderstanding about the meaning of 300.000
for non english speaking countries dealing with national number representation needs a
Quote: |
DECIMAL-POINT IS COMMA clause
DECIMAL-POINT IS COMMA
Exchanges the functions of the period and the comma in PICTURE character-strings and in numeric literals. |
|
|
Back to top |
|
 |
aedesy
New User
Joined: 11 Feb 2022 Posts: 6 Location: ITALY
|
|
|
|
Hi. I did try again with
Code: |
INSPECT WK-IMPORTO REPLACING ALL '.' BY ',' |
and it seems to work until it finds numbers like that: '4.826.100'
Here is the output:
Code: |
IMPORTO : 300,000
IMPORTO : 264,000
IMPORTO : 837,000
IMPORTO : 131,450
IMPORTO : 4,826,100
IGZ0152S Invalid character , was found in column 6 in argument-1 |
I think I should try with different INSPECT options. |
|
Back to top |
|
 |
aedesy
New User
Joined: 11 Feb 2022 Posts: 6 Location: ITALY
|
|
|
|
Seems to work using by NUMVAL-C function. Thanks. |
|
Back to top |
|
 |
|