Cobol copybook - Certain field conversions not happening correctly with...
Read Cobol data files in Java
Status: Beta
Brought to you by:
bruce_a_martin
i am using a Cobol copybook to retrive data from an EBCIDIC file . prolem is some of the fields especiallythose with names begining with NULLIF_...... do not convert correctly . Is there something I m doing wrong. Attaching the Copybook for reference..
Anonymous
Can you provide the Java / sample file. Also where is the file coming from ??? is it an IBM mainframe ???.
I will try and send you a message with my E-mail in case the data is sensitive
Hi,
I am using the RecordEditor 's load Cobol Copy book option where I give as inputs the copybook file name & the EBCDIC file name. Data is sensitive.
copy book file - tgen534 - Copy.cob
EBCDIC data file - 0.NONFIN
Actual expected output - 0.ASC
thecode file generated - dsc.rar
Thanks
Screen shot of output in RecordEditor is -
[cid:b4aba158-a865-45e3-98e4-9e8ecf153c5e]
From: Bruce Martin bruce_a_martin@users.sourceforge.net
Sent: Thursday, August 23, 2018 10:39 AM
To: [jrecord:bugs]
Subject: [jrecord:bugs] #24 Cobol copybook - Certain field conversions not happening correctly with RecordEditor
Can you provide the Java / sample file. Also where is the file coming from ??? is it an IBM mainframe ???.
I will try and send you a message with my E-mail in case the data is sensitive
[bugs:#24]https://sourceforge.net/p/jrecord/bugs/24/ Cobol copybook - Certain field conversions not happening correctly with RecordEditor
Status: open
Group: v1.0_(example)
Created: Thu Aug 23, 2018 09:16 AM UTC by Mandy P
Last Updated: Thu Aug 23, 2018 09:17 AM UTC
Owner: nobody
Attachments:
i am using a Cobol copybook to retrive data from an EBCIDIC file . prolem is some of the fields especiallythose with names begining with NULLIF_...... do not convert correctly . Is there something I m doing wrong. Attaching the Copybook for reference..
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/jrecord/bugs/24/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Bugs: #24
Change the Cobol dialect to Open Cobol, see attached.
This should get you almost what you want. The field NULLIF_CNY-MHT-IDN-TXT is defined as s9 comp which generates -1 instead of 255. changing it to 9 comp will generate 255.
Normally for IBM ZOS (Mainframe) Cobol I would expect a s9/9 Comp to occupy 2 bytes but in this file they are only 1 byte ???
See https://www.ibm.com/support/knowledgecenter/es/SSZJPZ_9.1.0/com.ibm.swg.im.iis.ds.mfjob.dev.doc/topics/r_dmnjbref_Storage_Lengths.html
The file looks to be a Database Extract (db2??)
Thanks , this is much better. I am told it is a Main Frame Dump from a Cobol source. getting a -1 instead of 255 I will have a closer look.
What do I do if I want to run this off the console or then may be put it as crond , say supply an input file name or directory
Rgds
From: Bruce Martin bruce_a_martin@users.sourceforge.net
Sent: Thursday, August 23, 2018 2:15 PM
To: [jrecord:bugs]
Subject: [jrecord:bugs] #24 Cobol copybook - Certain field conversions not happening correctly with RecordEditor
Change the Cobol dialect to Open Cobol, see attached.
[http://]
This should get you almost what you want. The field NULLIF_CNY-MHT-IDN-TXT is defined as s9 comp which generates -1 instead of 255. changing it to 9 comp will generate 255.
Normally for IBM ZOS (Mainframe) Cobol I would expect a s9/9 Comp to occupy 2 bytes but in this file they are only 1 byte ???
See https://www.ibm.com/support/knowledgecenter/es/SSZJPZ_9.1.0/com.ibm.swg.im.iis.ds.mfjob.dev.doc/topics/r_dmnjbref_Storage_Lengths.html
The file looks to be a Database Extract (db2??)
Attachments:
[bugs:#24]https://sourceforge.net/p/jrecord/bugs/24/ Cobol copybook - Certain field conversions not happening correctly with RecordEditor
Status: open
Group: v1.0_(example)
Created: Thu Aug 23, 2018 09:16 AM UTC by Mandy P
Last Updated: Thu Aug 23, 2018 10:39 AM UTC
Owner: nobody
Attachments:
i am using a Cobol copybook to retrive data from an EBCIDIC file . prolem is some of the fields especiallythose with names begining with NULLIF_...... do not convert correctly . Is there something I m doing wrong. Attaching the Copybook for reference..
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/jrecord/bugs/24/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Bugs: #24
The -1 is because of the s9 comp if you change to 9 Comp you will get 255. The s indicates sign. This dialect was set up for GNU-Cobol
What do I do if I want to run this off the console or then may be put it as crond , say supply an input file name or directoryHi
The auto-generated java code from report-writer shows the following error on compiling, what could be the problem -
javac -Xdiags:verbose ReadTgen534Copy.java
ReadTgen534Copy.java:70: error: method setDialect in interface ICobolIOBuilder cannot be applied to given types;
.setDialect("ICopybookDialects.FMT_GNU_COBOL"
)
^
required: int
found: String
reason: argument mismatch; String cannot be converted to int
1 error
==============
Java code -
==============
import net.sf.JRecord.JRecordInterface1;
import net.sf.JRecord.Details.AbstractLine;
import net.sf.JRecord.IO.AbstractLineReader;
import net.sf.JRecord.Common.Constants;
import net.sf.JRecord.External.CopybookLoader;
import net.sf.JRecord.def.IO.builders.ICobolIOBuilder;
import dsc.schema.FieldNamesTgen534Copy;
/*
* Read Cobol file using a Cobol Copybook (Tgen534Copy).
*
* This Generated program is intended as an example of using JRecord
* rather than a useful program (that compiles - it wont).
* You should regard it as a starting point and modify
* it according to needs
/
public final class ReadTgen534Copy {
}
From: Bruce Martin bruce_a_martin@users.sourceforge.net
Sent: Sunday, August 26, 2018 12:56 AM
To: [jrecord:bugs]
Subject: [jrecord:bugs] #24 Cobol copybook - Certain field conversions not happening correctly with RecordEditor
The -1 is because of the s9 comp if you change to 9 Comp you will get 255. The s indicates sign. This dialect was set up for GNU-Cobol
What do I do if I want to run this off the console or then may be put it as crond , say supply an input file name or directory
[bugs:#24]https://sourceforge.net/p/jrecord/bugs/24/ Cobol copybook - Certain field conversions not happening correctly with RecordEditor
Status: open
Group: v1.0_(example)
Created: Thu Aug 23, 2018 09:16 AM UTC by Mandy P
Last Updated: Thu Aug 23, 2018 02:15 PM UTC
Owner: nobody
Attachments:
i am using a Cobol copybook to retrive data from an EBCIDIC file . prolem is some of the fields especiallythose with names begining with NULLIF_...... do not convert correctly . Is there something I m doing wrong. Attaching the Copybook for reference..
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/jrecord/bugs/24/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Bugs: #24
In the short term remove the quotes if you have not already done so, I will fix the skelton
Yeah, that was done. it says unknown variable ,. replaced it with values of 0 then 1 then 2 but output is not as it should be., Report- editor shows the resuts correctly , so should n't this
try importing
There are javadocs explanations for all the methods
Yes , it works. Had missed it. Does this project have a facility to do Conversion without creating the Conversion code, guess that is what RecordEditor does. Where do we find the code for this
Thanks
From: Bruce Martin bruce_a_martin@users.sourceforge.net
Sent: Tuesday, August 28, 2018 5:58 AM
To: [jrecord:bugs]
Subject: [jrecord:bugs] Re: #24 Cobol copybook - Certain field conversions not happening correctly with RecordEditor
try importing
import net.sf.JRecord.Numeric.ICopybookDialects;
There are javadocs explanations for all the methods
[bugs:#24]https://sourceforge.net/p/jrecord/bugs/24/ Cobol copybook - Certain field conversions not happening correctly with RecordEditor
Status: open
Group: v1.0_(example)
Created: Thu Aug 23, 2018 09:16 AM UTC by Mandy P
Last Updated: Tue Aug 28, 2018 02:54 AM UTC
Owner: nobody
Attachments:
i am using a Cobol copybook to retrive data from an EBCIDIC file . prolem is some of the fields especiallythose with names begining with NULLIF_...... do not convert correctly . Is there something I m doing wrong. Attaching the Copybook for reference..
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/jrecord/bugs/24/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Bugs: #24
The RecordEditor does the GUI based Conversion:
Source code for the RecordEditor:
https://sourceforge.net/p/record-editor/code/HEAD/tree/Source/
say in a line of code like - line.getFieldValue("ITN-IDN-CDE").asString()
ls ".asString( )" the method to handle Text , COMP & COMP-3 ? or do we have something else for COMP, COMP3 ?
I have the ascii converted dump given to me from some other utility (which does it accurately), one of the difference noted, for example is - that a field NULLIF_LNG-MHT-NME-TXT gets translated in JRecord as 0 where as the actual data is 0000 . Any idea why this is happening ? any way to deal with it ? in the copy book this field is specified as PIC 9 USAGE COMP
Attaching the ASCII file 0.ASC for reference for the same data.
one more instance is LCN-CTT-IDN-NBR PIC S9(9) USAGE COMP JRecord shows it as 45731 however it should be 000045731
From: Bruce Martin bruce_a_martin@users.sourceforge.net
Sent: Wednesday, August 29, 2018 2:11 PM
To: [jrecord:bugs]
Subject: [jrecord:bugs] #24 Cobol copybook - Certain field conversions not happening correctly with RecordEditor
You can use any of the as... methods at any time, JRecord will try and do the conversion for you.
You can do asInt on a Text field; JRecord will try and convert it to an integer. If field contins non numeric Data you will have a problem.
For a pic s9(4)V9(4) you may want to convert it to either a Double or BigDecimal
[bugs:#24]https://sourceforge.net/p/jrecord/bugs/24/ Cobol copybook - Certain field conversions not happening correctly with RecordEditor
Status: open
Group: v1.0_(example)
Created: Thu Aug 23, 2018 09:16 AM UTC by Mandy P
Last Updated: Tue Aug 28, 2018 01:51 PM UTC
Owner: Bruce Martin
Attachments:
i am using a Cobol copybook to retrive data from an EBCIDIC file . prolem is some of the fields especiallythose with names begining with NULLIF_...... do not convert correctly . Is there something I m doing wrong. Attaching the Copybook for reference..
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/jrecord/bugs/24/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Bugs: #24
Neither answers are wrong they a different packages and do thingd differently.
you will find 0 == 0000 gives True and 45731 == 000045731 as well
In Cobol Pic 9 means 1 digit numeric number, I see printing it as 0000 as a strange idosyncroncy of your exising package.
While PIC S9(9) means an integer of maximum length of 9.
You can use any of the as... methods at any time, JRecord will try and do the conversion for you.
You can do asInt on a Text field; JRecord will try and convert it to an integer. If field contins non numeric Data you will have a problem.
For a
pic s9(4)V9(4)you may want to convert it to either a Double or BigDecimal