Hi bruce,
i have copybook file and data file which is having binary data with .txt files. i am able to parse copybook(UTF-8) and data file(ANSI and tried with UTF-8 as well) values but the data file values are getting as encrypted. i tried with changing encoding value of file but the results are same. here i'm attaching my copybook and data file sample values(not full file but the format is same if needed i can share screenshot). please find the code snippet below
CobolIoProviderioprovider=CobolIoProvider.getInstance();FileInputStreamcopyStream=newFileInputStream(newFile(filename));AbstractLineReaderreader=ioprovider.newIOBuilder(copyStream," test file copy book",ICopybookDialects.FMT_MAINFRAME).setFont("CP037").setFileOrganization(Constants.IO_FIXED_LENGTH_RECORDS).setSplitCopybook(CopybookLoader.SPLIT_NONE).newReader(datafilename);AbstractLinepolicy;Layoutdetaillayout=reader.getLayout();details=layout.getFieldNameMap();StringBufferstringwriter=newStringBuffer();while((policy=reader.read())!=null){finalAbstractLinepolicyF=policy;details.entrySet().stream().forEachOrdered(e->stringwriter.append(getCleanFeildValue(policyF,e)).append(",");stringwriter.append(System.lineSeparator());}privatestaticStringgetCleanFeildValue(AbstractLinepolicyF,Entry<String,IFieldDetail>e){Stringvalue=policyF.getFieldValueIfExists(e.getKey()).asString();if(value.matches("[f]+")){Value="";}returnvalue;}
while reading i am also getting exception in getCleanFieldValue() method as
net.sf.JRecord.Common.RecordException: DIS-TRR-SECONDS: Invalid Zoned Decimal: ???????
i tried remove the exception occuring feilds in copy book and executed i'm getting exception for
PIC S9(7)V99.
PIC S999V COMP-3.
PIC S9(07)V99 COMP-3.
can you please help how to read these values and how to get string type values without encryption
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi bruce,
i have copybook file and data file which is having binary data with .txt files. i am able to parse copybook(UTF-8) and data file(ANSI and tried with UTF-8 as well) values but the data file values are getting as encrypted. i tried with changing encoding value of file but the results are same. here i'm attaching my copybook and data file sample values(not full file but the format is same if needed i can share screenshot). please find the code snippet below
while reading i am also getting exception in getCleanFieldValue() method as
net.sf.JRecord.Common.RecordException: DIS-TRR-SECONDS: Invalid Zoned Decimal: ???????
i tried remove the exception occuring feilds in copy book and executed i'm getting exception for
PIC S9(7)V99.
PIC S999V COMP-3.
PIC S9(07)V99 COMP-3.
can you please help how to read these values and how to get string type values without encryption
I can not really tell anything from what you have provided I really need to see a data file & Copybook. I have tried to send you my direct e-mail
Is this file from the mainframe ??? and have you transfered as EBCDIC (i.e. no translation of the file) also called a binary transfer.
If you can look at the file in a normal text editor and can read it - you have a problem.