0

I have created layout based on cobol copybook.

Layout snap-shot:

enter image description here

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 enter image description here

Input file can be find below attachment

enter link description here

or

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

Expected output:

enter image description here

Related thread Unpacking COMP-3 digit using Java

Bruce Martin
  • 10,358
  • 1
  • 27
  • 38
Rahul Patel
  • 307
  • 1
  • 9
  • 27

1 Answers1

0

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.
Bruce Martin
  • 10,358
  • 1
  • 27
  • 38
  • Hi Bruce, I have a COBOL formatted input file in . txt format which is FTP'ed from the Mainframe System. In that file, all the columns have been converted from EBCDIC to ASCII but few columns strting from Class-Order till County - No and also the last four columns are still in EBCDIC format.st – Rahul Patel Aug 14 '17 at 11:49
  • If the file is F100BR.EDGEOUT.DET2SUM.F2017JUL_new.txt in the question. The comp-3 fields have been corrupted by the EBCDIC --> Ascii. – Bruce Martin Aug 14 '17 at 12:06
  • Yes it is for the same input file and the same copybook which am posting since last few days .But we have the output file generated from the Mainframe for the same input file which has got the values for those columns and that is also in .txt format supplied by our clients as they dont have Mainframe system . – Rahul Patel Aug 14 '17 at 12:13
  • If you did a Ebcdic -->> Ascii conversion on a file with comp/comp-3 data; the binary fields are screwed. Read my answer with regards 400 --> 200. This will happen to here and there through out the binary fields. Do a binary transfer or convert the field to text on the mainframe – Bruce Martin Aug 14 '17 at 12:29
  • Kindly let us know the steps, how to process data file once we receive from mainframe system in txt format. – Rahul Patel Aug 14 '17 at 12:46
  • 1
    If it is binary, you can not – Bruce Martin Aug 14 '17 at 22:57
  • In the first answer I gave https://stackoverflow.com/questions/45567511/unpacking-comp-3-digit-using-java/45634602#45634602, I told you to do a binary transfer; it is the only way – Bruce Martin Aug 14 '17 at 23:13
  • Bruce - We have requested Binary file and they have sent to us and still we are facing issues while loading in Record Editor . Now all the columns displaying it as Special Characters and we are not sure how to take it forward as we dont have Mainframe access. Kindly provide us step by step process from starting to ending of this process as we cannot go back and ask us to provide the Binary file to us. – Rahul Patel Aug 17 '17 at 07:47