NumberFormatException upon Reading from a Cobol COMP-3 Numeric Variable in Java
Last updated on OCTOBER 18, 2016
Applies to:Oracle Utilities Framework - Version 2.2.0 and later
Information in this document applies to any platform.
NumberFormatException is raised while getting information of a Cobol COMP-3 numeric variable in Java. The value of a specific copybook variable (declared as follows) is retrieved during a Java development:
03 DETTE PIC CI-CONST-MAX-AMT-STORE.
CI-CONST-MAX-AMT-STORE is a standard constant declared as a compressed signed decimal value ( S9(13)V9(2) COMP-3 ). In Java after generating artifacts, method get_DETTE() is used which returns a BigInteger value. But at execution, the program fails with a NumberFormatException. It is suspected to be a problem with artifacts generation - the returned class would be BigDecimal and not BigInteger.
The issue can be reproduced at will with the following steps:
To call a Cobol process from the Java service:
1. Create CobolCopybookCMCBCDTN_Impl class and its associated cobol program.
2. Use these in the Java service (CMMPRMAINIPageMaintenance.java) to retrieve an output variable ("DETTE") which is the value needed for use in Java.
3. This variable is declared as "S9(13)V9(2) COMP-3"
4. Generate the artifacts to create all dependences.
5. deploy and execute the program
6. when it executes the command "vCobolCopybookCMCBCDTN.get_OUTPUT_WRK().get_DETTE()", the NumberFormatException is raised.
Why is this error raised and is there a solution or workaround?
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms