I have created layout based on cobol copybook.
Layout snap-shot:
I tried to load data also selecting same layout, it gives me wrong result for some columns. I try using all binary numeric type.
- CLASS-ORDER-EDGE
- DIV-NO-EDG
- OFFICE-NO-EDG
- REG-AREA-NO-EDG
- CITY-NO-EDG
- COUNTY-NO-EDG
- BILS-COUNT-EDG
- REV-AMOUNT-EDG
- USAGE-QTY-EDG
- GAS-CCF-EDG
Input file can be find below attachment
or
https://drive.google.com/open?id=0B-whK3DXBRIGa0I0aE5SUHdMTDg
Expected output:
Related thread Unpacking COMP-3 digit using Java
First Problem you have done an EBCDIC --> ascii conversion on the file !!!!
The EBCDIC --> ascii conversion will also try and convert binary fields as well as text.
For example:
Comp-3 value hex hex after Ascii conversion
400 x'400c' x'200c' x'40' is the ebcdic space character
it gets converted to the ascii
space character x'20'
You need to do binary transfer, keeping the file as ebcdic:
- Check the file on the Mainframe if it has a RECFM=FB you can do a transfer
- If the file is RECFM=VB make sure you transfer the RDW (Record Descriptor word) (or copy the VB file to a FB file on the mainframe).
Other points:
You will have to update RecordEditor/JRecord
- The font will need to be ebcdic (cp037 for US ebcdic; for other lookup)
- The FileStructure/FileOrganisation needs to change (Fixed length / VB)
Finally
- BILS-Count-EDG is either 9 characters long or starts in column 85 (and is 8 bytes long).
- You should include Xml in as text not copy a picture in.
- In the RecordEditor if you Right click >>> Edit Record; it will show the fields as Value, Raw Text and Hex. That is useful for seeing what is going on
- You do not seem to accept many answers; it is not relevant whether the answer solves your problem; it is whether the answer is correct answer for the question.
来源:https://stackoverflow.com/questions/45637188/unpacking-comp-3-digit-using-record-editor-jrecord