convert cobol COMP data to ASCII

耗尽温柔 提交于 2019-12-13 03:36:02

问题


I'm converting some COBOL dat file to ASCII using utility vutil:

vutil -extract input.dat > output.txt

I can't get a human readable response from COMP data fields. Here's is part of my FD file

05 FAT-TIPOFT   PIC 9(4).
05 FAT-DINI     PIC 9(8).
05 FAT-DFIN     PIC 9(8).
05 FAT-IMPON    PIC S9(7)V99 COMP.
05 FAT-INPS     PIC 99.
05 FAT-IMPINPS  PIC S9(7)V99 COMP.
05 FAT-IVA      PIC 99.

And here an ASCII convertion example:

0107200230062003 ‚p00    20  ³° 6 00     6       

The convertion is fine only for the NON-COMP fields

Is there any additional command or alternative utility or technique to convert COMP fields?

Note I don't want to enter into Cobol world, I just want to convert data and get rid of it!


回答1:


Possible solutions:

  1. You may not want to write a Cobol program, for one file, it will probably be the quickest & cheapest solution.

  2. There are various commercial packages that claim to read Acu Cobol files, probably expensive though.

  3. For this file, you could look at the RecordEditor, with a bit of fiddling you might (and I do mean might) get it work. For this Cobol-Copybook try importing it as a Mainframe or Open-Cobol copybook. I suspect Open-?Cobol Microfocus might be better. (Note: I am the author of the RecordEditor)


I think data might be, with out the binary file and the original data, I can not be sure.

The first 16 bytes in the supplied data look like 2 dates, so I have aligned with FAT-DINI/FAT-DFIN, this is just a guess though:

    0107200230062003  ‚p00    20
22223333333333333333008733000033
00000107200230062003002000000020

in The recordEditor I get:


In the RecordEditor lib directory, there is a JRecord.properties for "defining Cobol dialects".



来源:https://stackoverflow.com/questions/31921354/convert-cobol-comp-data-to-ascii

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!