I have data in my input file - {0000000000
the copybook defines it - 10 EDIIVC-IVCH-CASH-DISC PIC S9(7)V9999.
The following causes a java.lang.NumberFormatException when the following line is executed -
System.out.println(((FieldValueLine) inputRecord.getFieldValue("EDIIVC-IVCH-CASH-DISC")).asBigDecimal());
Executing the following shows - {0000000000
System.out.println(((FieldValueLine) inputRecord.getFieldValue("EDIIVC-IVCH-CASH-DISC")));
This is being generated by our EDI vendor and I am not sure how it is being created. But they are using the copybook to read it with the mainframe, we need to now process it within Java.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After wasting a bit of time, I have finally worked out what is going on.
The file is not a valid Cobol Data file.
For a s9(8) field with a value of 3210 should be stored a 0000321{ but in the file it is stored as 321{0000.
i.e. leading zero's have become trailing zero's.
I am presuming the mainframe programs correct the file
before processing it. Please comfirm this by checking mainframe !!!!
If I am correct, it will be easy to handle with JRecord, I will show you how
Last edit: Bruce Martin 2017-12-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have data in my input file - {0000000000
the copybook defines it - 10 EDIIVC-IVCH-CASH-DISC PIC S9(7)V9999.
The following causes a java.lang.NumberFormatException when the following line is executed -
System.out.println(((FieldValueLine) inputRecord.getFieldValue("EDIIVC-IVCH-CASH-DISC")).asBigDecimal());
Executing the following shows - {0000000000
System.out.println(((FieldValueLine) inputRecord.getFieldValue("EDIIVC-IVCH-CASH-DISC")));
Here is how I have the reader configured -
What am I doing wrong?
Is the copybook
or is it some thing like (with a sign leading option):
for 10 EDIIVC-IVCH-CASH-DISC PIC S9(7)V9999 I would expect 0000000000{ with the sign at the end and not the start.
At the moment JRecord would not handle the sign leading option as it is extremly rare. If you do have the sign leading option, I will update JRecord.
So please let me know exactly what is in the Copybook. I will make the changes to JRecord.
The copybook has -
10 EDIIVC-IVCH-CASH-DISC PIC S9(7)V9999
This is being generated by our EDI vendor and I am not sure how it is being created. But they are using the copybook to read it with the mainframe, we need to now process it within Java.
Just sent you an e-mail (with my e-mail address); can you send me the full copybook please.
There is 2 reasons:
Full data also would be good
Never seen sign leadingf used before. I will update JRecord:
Should have a new version in a couple of days
After wasting a bit of time, I have finally worked out what is going on.
The file is not a valid Cobol Data file.
For a s9(8) field with a value of 3210 should be stored a
0000321{ but in the file it is stored as 321{0000.
i.e. leading zero's have become trailing zero's.
I am presuming the mainframe programs correct the file
before processing it.
Please comfirm this by checking mainframe !!!!
If I am correct, it will be easy to handle with JRecord, I will show you how
Last edit: Bruce Martin 2017-12-17