开发者

Possible to export COBOL VISION database to comma delimited .csv?

开发者 https://www.devze.com 2023-04-01 14:17 出处:网络
We have a system based on AcuCobol and vision-files. We need to dump the entire datafiles in to txt-based files to be imported in to a sql server.

We have a system based on AcuCobol and vision-files.

We need to dump the entire datafiles in to txt-based files to be imported in to a sql server.

We are using vutil to dump the data right now, but it's creating a fixed-width file and we would wa开发者_如何学JAVAnt this to be a delimited file of some sort. The command we are using right now is this:

vutil -unload -t sourcefile destinationfile

Now does anyone have any experiance with this, and if so, what would be the best utility for this?


what I'll do to get the job done is this:

Unload your table with a JCL into a file. Use this file in a batch, with a copybook matching the description of the table : (ex: if your table has 3 columns [ID], [NAME] and [ADDRESS], then create a copy CC-1 with:

 O1 CC-1 
    05 ID   PIC X (16).
    05 NAME PIC X (35).
    05 ADDRESS PIC X (35).

For each line move the line into the copy CC-1.

Create a second copy CC-2

  O1 CC-2 
    05 ID   PIC X (16).
    05 FILLER PIC X VALUE ';'.
    05 NAME PIC X (35).
    05 FILLER PIC X VALUE ';'.
    05 ADDRESS PIC X (35).
    05 FILLER PIC X VALUE ';'.

Do a move corresponding of CC-1 to CC-2 Write in the output. This for each line. You get in the output a CSV file of all your data.

You can reuse the batch and JCL, you just have to change the size of the records and the descriptions of the copy to match the table you are unloading.

Free and easy. :)


Google is your friend... I did a quick search and came up with NextForm which claims to convert Vision to CSV (and other formats).

From the "fine print" it looks like you can download a trial copy but will have to fork out about $400.00 to get a licenced version (that won't drop random records).

I have absolutely no experience with this product so cannot tell you if it really does the job or not.

Edit

Sometimes it is more productive to work with rather than fight against a legacy system.

Have you looked at AcuODBC? This lets Windows programs read/import Vision files. You could potentially use this to access Vision files from any Windows ODBC enabled application. I believe you may need to compile a data dictionary to make this work, but it could provide a bridge between where you are and where you want to be.

Another approach might be to write your own dump programs in AcuCobol. Read a record, format and write it. Writting a Cobol program of this complexity should not be too challenging a task provided the files do not have a complex structure (eg. multiple record types/layouts in the same file, or repeating fields within a single record).

Your task will be significantly more complex if a single Vision file needs to be post-processed into multiple SQL Server tables. Unfortunately, complex conversions are fairly common with Cobol legacy systems because of their tendancy to use rich/complex/denormalized file structures (unlike SQL which works best with normalized tabular data).

If the Vision files are more complex that a single SQL Server table, then maybe you could consider using the AcuXML Interface to dump the files into XML and then use an XSLT processor to create CSV or whatever other format you need from there. This would allow you to work with fairly complex Cobol record structures. Again, this approach means writting some fairly basic AcuCOBOL font end programs.

Based on your comments to my original post, you are not a die-hard Cobol programmer. Maybe it would be a good idea to team up with someone in your shop that has a working knowledge of the language and environment before pushing this any further. I have a feeling that this task is going to be a bit more complicated than "dump and load".


If you have Acubench under the Tools Menu there is an option for Vision File Utility, from there you can Unload your Vision Data to a text file which is tab delimited.

From there you can import to Excel as a tab delimited file and then re-save as a csv file.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号