Dear Bruce Martin,
Need your help to understand when there is junk data which is like 40404 and 404040 pattern we need to catch this data and through the nulls , could you please help to understand where can we catch this .
Regards
Naren
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
if (! "".equals(line).getFieldValue("field-name").asString())
should work in this case. In general there will probably be a field-value that tells you wether a field is used or not. Once you understand how the copybook works you may not need to do space checks.
There are also isLowValues() and isHighValues() tests.
While many cobol Copybooks are simple and straightforward. This is not always the case (particularly for old systems). For some Cobol Copybooks you need to know the Rules
associated with the copybook to understand what is going on. Unfortunately the Cobol
itself does not tell you this. In a lot of case an experienced Cobol programmer could look at the copybook and tell you what is going on. But in others in falls in General knowledge.
public static String getDecimal(final byte[] record, final int start, final int fin) {
method ret field giving 4040404040404c,0c40404040 and 404040404040 patterns are coming instead blanks those are actually junk values.PLease help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By the sounds of it, the field is not being initialised and it is picking up
whatever was there before the record was created (not really the correct term for cobol).
You really need to talk to the Cobol programmers about the field. They should
know when the field has valid data (they may have look at the program though).
The cobol programmers would face a similar problem; they would know when to access
the field and when not to.
There will be some way to determine if the field has valid data or is junk.
Check the flags / 88 levels in the Cobol Copybook. One thing they will not be
doing in Cobol is validating the field.
The other alternative would be update the Cobol program and initialise the
record/field to hex zero's. This would work if there are no redefines.
If you show me the Copybook / file, I might be able to figure it out
(if the file is reasonably simple).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Bruce,space byte is 64 and 40 number also byte 64 is coming because of that we are not able to catch space byte and if we catch we are loosing values which has 40 .please help.
Regards
Naren
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am tagging to this thread as I have a question regarding the 404040 pattern.
The sytem that I am getting the data from sometimes does not initialise the comp-3 field resulting in spaces. So, when I read them through JRecord, I get 40404 which as you indicated is space char in Ebcdic
Unfortunately, I do not have control over the cobol side of things nor can I get anyone to fix it at their end. Is there anything I can do in the java side to take care of this issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some data from source (Cobol) has invalid data with NUL as part of the string. Find attched capture.jpg. This causes a problem when I try to insert the data in the downstream system.
Is there anything I can do in the java side to take care of this issue. Thank you
Dear Bruce Martin,
Need your help to understand when there is junk data which is like 40404 and 404040 pattern we need to catch this data and through the nulls , could you please help to understand where can we catch this .
Regards
Naren
x'40' is the space char in Ebcdic; so
should work in this case. In general there will probably be a field-value that tells you wether a field is used or not. Once you understand how the copybook works you may not need to do space checks.
There are also isLowValues() and isHighValues() tests.
While many cobol Copybooks are simple and straightforward. This is not always the case (particularly for old systems). For some Cobol Copybooks you need to know the Rules
associated with the copybook to understand what is going on. Unfortunately the Cobol
itself does not tell you this. In a lot of case an experienced Cobol programmer could look at the copybook and tell you what is going on. But in others in falls in General knowledge.
you may have
Unfortunately it is more likely to be
in which case you need to know the abreviations used
Last edit: Bruce Martin 2017-02-02
public static String getDecimal(final byte[] record, final int start, final int fin) {
method ret field giving 4040404040404c,0c40404040 and 404040404040 patterns are coming instead blanks those are actually junk values.PLease help.
By the sounds of it, the field is not being initialised and it is picking up
whatever was there before the record was created (not really the correct term for cobol).
You really need to talk to the Cobol programmers about the field. They should
know when the field has valid data (they may have look at the program though).
The cobol programmers would face a similar problem; they would know when to access
the field and when not to.
There will be some way to determine if the field has valid data or is junk.
Check the flags / 88 levels in the Cobol Copybook. One thing they will not be
doing in Cobol is validating the field.
The other alternative would be update the Cobol program and initialise the
record/field to hex zero's. This would work if there are no redefines.
If you show me the Copybook / file, I might be able to figure it out
(if the file is reasonably simple).
Hi Bruce,space byte is 64 and 40 number also byte 64 is coming because of that we are not able to catch space byte and if we catch we are loosing values which has 40 .please help.
Regards
Naren
I do not understand the last comment. Can you expand on a bit / give me a Cobol picture / raw data
Note: In ebcdic Space=x'40'= decimal 64.
Hi Bruce,
I am tagging to this thread as I have a question regarding the 404040 pattern.
The sytem that I am getting the data from sometimes does not initialise the comp-3 field resulting in spaces. So, when I read them through JRecord, I get 40404 which as you indicated is space char in Ebcdic
PIC 9V9(3) COMP-3. = 404.04
PIC 9(8) COMP-3. = 4040404040
PIC 9(8) COMP-3. = 4040404040
PIC S9(7)V99 COMP-3. = 40404040.4
PIC V9(3) COMP-3. = 4.04
Unfortunately, I do not have control over the cobol side of things nor can I get anyone to fix it at their end. Is there anything I can do in the java side to take care of this issue.
At the moment try using the asHex() method is probably as easy as anything;
alternatively casting back to line could be used:
not very elagant but it should work, I will update JRecord with a spaces test but that that will not be released for a while
Last edit: Bruce Martin 2017-02-02
I have updated JRecord Source in subversion. This update includes
I am not in a possition to do a JRecord release at the moment. If you want to apply my changes to you JRecord Code, the relavent changes are in
The Tests are:
Hi Bruce,
Thank you very much ..For now, I have added your initial solution and hopefully that should solve my problem.
Hi Bruce,
Sorry to tag this question in the same thread.
Some data from source (Cobol) has invalid data with NUL as part of the string. Find attched capture.jpg. This causes a problem when I try to insert the data in the downstream system.
Is there anything I can do in the java side to take care of this issue. Thank you
I presume it is lowvalue (x'00') in which case you can use the isLowValues() test: