It seems the Java application does not interpret the hyphen "-" as a part of the field name. Rather the name will be cut at "-" and only the part after ("FT", "POS"...) will be delivered by the code line "entry.getKey()".
Another issue is: the field names will be not delivered in the loop in the sequence defined in the copybook (here the corresponding part of my code).
AbstractLineReaderreader=ioProvider.getLineReader(fileStructure,Convert.FMT_MAINFRAME,CopybookLoader.SPLIT_NONE,copybookName,salesFile);AbstractLineWriterwriter=ioProvider.getLineWriter(fileStructure,salesFileOut);while((saleRecord=reader.read())!=null){lineNum+=1;Mapmymap=newHashMap();mymap=saleRecord.getLayout().getFieldNameMap();Setset=mymap.entrySet();//Converting to Set so that we can traverse Iteratoritr=set.iterator();while(itr.hasNext()){//Converting to Map.Entry so that we can get key and value separately Map.Entryentry=(Map.Entry)itr.next();**System.out.println("field...:"+entry.getKey()+" **"+entry.getValue().toString());}...}
And a last question. Is JRecord runnable on a mainframe (perhaps using JZOS to read the mainframe files)?
Best regards,
Gabor
Last edit: Bruce Martin 2020-03-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Firstly it would be better to use the JRecordInterface1.COBOL.newIOBuilder(>>) interface.
It seems the Java application does not interpret the hyphen "-" as a part of the field name. Rather the name will be cut at "-" and only the part after ("FT", "POS"...) will be delivered by the code line "entry.getKey()".
Depends on what attributes are set. The setDropCopybookNameFromFields(boolean)
of the Iobuilder controls wether the Copybook name is dropped from the front of
field-names.
And a last question. Is JRecord runnable on a mainframe (perhaps using JZOS to read the mainframe files)?
I have not tried, probably. It should be possible use JZOS to read/write files
but you will need to write some interface code.
in JRecord you can use the IByteRecordReader, IByteRecordWriter interfaces with
newLineReader / newLineWriter methods.
To read a file using JZOS, You would need to create a class that implements IByteRecordReader
that uses JZOS to read the file and returns an array of bytes
publicinterfaceIByteRecordReader{/** * Read one line from the input file as an array of bytes * * @return line read in * * @throws IOException io error */byte[]read()throwsIOException;/** * Closes the file * * @throws IOException io error */voidclose()throwsIOException;}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Firstly it would be better to use the JRecordInterface1.COBOL.newIOBuilder(>>) interface.
It seems the Java application does not interpret the hyphen "-" as a part
of the field name. Rather the name will be cut at "-" and only the part
after ("FT", "POS"...) will be delivered by the code line "entry.getKey()".
Depends on what attributes are set. The setDropCopybookNameFromFields(boolean)
of the Iobuilder controls wether the Copybook name is dropped from the
front of
field-names.
And a last question. Is JRecord runnable on a mainframe (perhaps using
JZOS to read the mainframe files)?
I have not tried, probably. It should be possible use JZOS to
read/write files
but you will need to write some interface code.
in JRecord you can use the IByteRecordReader, IByteRecordWriter interfaces
with
newLineReader / newLineWriter methods.
To read a file using JZOS, You would need to create a class that
implements IByteRecordReader
that uses JZOS to read the file and returns an array of bytes
/** * Read one line from the input file as an array of bytes * * @return line read in * * @throws IOException io error */byte[] read()throwsIOException;/** * Closes the file * * @throws IOException io error */voidclose()throwsIOException;}
issues 1. (Java application does not interpret the hyphen "-" as a part
of the field name) and 2. (field names will be not delivered in the loop in the
sequence defined in the copybook ) are clear now, thanks.
As for JZOS: I'll try to implement your suggestion in the next time.
Regards
Gabor
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear Support,
I've tried to run a sample application to read a (downloaded) mainframe file by using a COBOL data structure definition, something like this:
It seems the Java application does not interpret the hyphen "-" as a part of the field name. Rather the name will be cut at "-" and only the part after ("FT", "POS"...) will be delivered by the code line "entry.getKey()".
Another issue is: the field names will be not delivered in the loop in the sequence defined in the copybook (here the corresponding part of my code).
And a last question. Is JRecord runnable on a mainframe (perhaps using JZOS to read the mainframe files)?
Best regards,
Gabor
Last edit: Bruce Martin 2020-03-13
Firstly it would be better to use the JRecordInterface1.COBOL.newIOBuilder(>>) interface.
It seems the Java application does not interpret the hyphen "-" as a part of the field name. Rather the name will be cut at "-" and only the part after ("FT", "POS"...) will be delivered by the code line "entry.getKey()".
of the Iobuilder controls wether the Copybook name is dropped from the front of
field-names.
Another issue is: the field names will be not delivered in the loop in the sequence defined in the copybook (here the corresponding part of my code).
And a last question. Is JRecord runnable on a mainframe (perhaps using JZOS to read the mainframe files)?
but you will need to write some interface code.
in JRecord you can use the IByteRecordReader, IByteRecordWriter interfaces with
newLineReader / newLineWriter methods.
To read a file using JZOS, You would need to create a class that implements IByteRecordReader
that uses JZOS to read the file and returns an array of bytes
The IByteRecordReader interface:
Hello Bruce,
thanks for the prompt answer, I will try asap, and let you know.
Regards
Gabor
Am Fr., 13. März 2020 um 14:35 Uhr schrieb Bruce Martin bruce_a_martin@users.sourceforge.net:
Hello Bruce,
issues 1. (Java application does not interpret the hyphen "-" as a part
of the field name) and 2. (field names will be not delivered in the loop in the
sequence defined in the copybook ) are clear now, thanks.
As for JZOS: I'll try to implement your suggestion in the next time.
Regards
Gabor