问题
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:
You may not want to write a Cobol program, for one file, it will probably be the quickest & cheapest solution.
There are various commercial packages that claim to read Acu Cobol files, probably expensive though.
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