View previous topic :: View next topic
|
Author |
Message |
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
Hi,
JIYZ0151-CDGCOMER PIC X(15).
PT-CPTRAMS-STORE PIC 9(12).
COMPUTE PT-CPTRAMS-STORE = FUNCTION NUMVAL(JIYZ0151-CDGCOMER)
END-COMPUTE
Input is
JIYZ0151-CDGCOMER
X(15) DISP '00000100802HOUS'
I am getting error:
IGZ0152S Invalid character O was found in column 13 in argument-1 for function NUMVAL in program JICZ669 at
displacement X'335C'.
From compile unit JICZ669 at entry point JICZ669 at statement 1380 at compile unit offset +0000335C at entry
offset +0000335C at address 16D04304.
I had expected that NUMVAL will move 00000100802 into PT-CPTRAMS-STORE. However, program is abending on 'O'. I wondering why not 'H' or 'S'.
Could you please explain why is it abending, why NUMVAL is not working? Why is it pointin to 'O'?
Many thanks,
Zurich Lad |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
because H is a valid zoned decimal signed +8,
even though O s a valid zoned decimal signed -6,
NUMVAL does not accept more than 1 sign.
IF you would refer to the documentation about NUMVAL,
you will see that the function only accepts certain characters.
even for NUMVAL the text garbage has to be culled.
you could use an INSPECT CONVERTING before the NUMVAL
or determine exactly in your text where valid numeric data ends
and garbage begins
and use REFERENCE MODIFICATION on the NUMVAL. |
|
Back to top |
|
|
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
Thanks very much Dick.
It was interesting surprise knowing NUMVAL does not accept more than one sign.
i will use INSPECT and REFERENCE MOD to fetch numeric part.
Regards. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
It was interesting surprise knowing NUMVAL does not accept more than one sign. |
well, to be honest, I did not find that in any manual.
I just figured,
what would NUMVAL do with two (2) signs? |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
Quote: |
I just figured,
what would NUMVAL do with two (2) signs?
|
Like the OP just experienced: It rolls over and dies... |
|
Back to top |
|
|
|