-->

Unpacking COMP-3 digit using Record Editor/Jrecord

2020-04-30 16:31发布

问题:

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.

  1. CLASS-ORDER-EDGE
  2. DIV-NO-EDG
  3. OFFICE-NO-EDG
  4. REG-AREA-NO-EDG
  5. CITY-NO-EDG
  6. COUNTY-NO-EDG
  7. BILS-COUNT-EDG
  8. REV-AMOUNT-EDG
  9. USAGE-QTY-EDG
  10. GAS-CCF-EDG

result snapshot

Input file can be find below attachment

enter link description here

or

https://drive.google.com/open?id=0B-whK3DXBRIGa0I0aE5SUHdMTDg

Expected output:

Related thread Unpacking COMP-3 digit using Java

回答1:

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:

  1. Check the file on the Mainframe if it has a RECFM=FB you can do a transfer
  2. 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.