问题
I've never read COBOL in my life and have been tasked with rewriting the old COBOL code in a new language. Are there any free or free-to-try software packages out there that will generate a flow chart for a COBOL program?
I've looked at "Visustin" and "Code Visual to Flowchart"
Visustin blanks out part of the code and does random rotations in the demo version, which causes the demo to be less accurate.
I couldn't get Code Visual Flow Chart to work correctly with our code.
Know of any other packages I might try?
回答1:
I've written a simple flow chart generator for COBOL in python, which uses Graphiz. It's really trivial and generate a .jpg chart that is useful for my purposes, maybe it won't be the same for you.
Anyway, if you want you can send me a mail here http://www.contactify.com/a6148 and i'll send you my little script. If you're on linux you almost certainly have python installed, on windows you have to install it together with yapgvb module
Let me know! Bye
回答2:
I don't envy you. For the most part, tracing through a COBOL program by hand is fairly straightforward (albeit tedious). I've been in the same situation, and ended up doing it by hand. It never hurts to learn a new language anyways, so it's not entirely in vain.
Look for the phrase "PROCEDURE DIVISION" and start there. Follow into any "PERFORM" statements you run into to trace the logic. If you don't end up killing yourself you'll come out a better person.
回答3:
COBOL is older than BNF notation and cannot be described using any LR(k) type grammar. Most of the popular lexing/parsing strategies do not work for this language (at least not without a lot of late nights and fowl language). Consequently, quality parsers for COBOL are hard to come by. Those that exist generally command a pretty penny.
Without robust, freely available, parsers your chances of finding free (as in speech, forget beer) diagramming tools for COBOL are pretty slim. Everything I have come across is (I am being charitable here) pretty weak.
Building you own tools can be a daunting task. Have a look at COBOL Grammar. COBOL is a big language, be prepared to do some serious work.
First do some serious math: How much code needs to be converted? How much is it worth to get rid of COBOL? If a sound financial argument cannot be made, then just live with your current COBOL application.
If you can make a case to proceed, then you might try looking into OpenCobol as a starting point for your code analysis/conversion system. However, you will need to be up-to-seed on both C and COBOL to make this work. If you are working with an IBM COBOL dialect, and have access to an IBM mainframe compiler, then look into the ADATA compiler option, this will give you an AST of your program. These are some possible starting points.
The alternative is to obtain a commercial COBOL conversion/renovation product. I do not have much personal experience with these products and cannot recommend any particular one over another.
If the math doesn't support learning COBOL well enough to do the conversion, then just live with the existing COBOL application. You would not be the first person to come to this conclusion!
回答4:
I'm looking for one of those as well.
I'm currently writing NEW COBOL programs but the project manager wants pictures even though the programs are written, tested and deployed!
The visustin thing looks good but takes quite a long time to analyze some of the programs. Probably due to them being rather large. The smallest is 3500+ lines.
It also doesn't help that I'm working on a UNiSYS mainframe using COBOL74, and vistustin doesn't understand some (any) of the COBOL74 extensions for DMSII.
Any how time is pressing so we've just ordered a copy. Hopefully it'll be good enough for those who can't read words and need to see it as diagrams.
回答5:
IBM has a product called Asset Analyzer (these days it is probably being marketed as the Rational Websphere Asset Analyzer or some such).
It will analyze your entire library of Cobol source and help you refactor as well as give plenty of program understanding reporting. It actually builds out a website so you can surf your program logic at as high or low level as you like.
回答6:
No, there is no reliable COBOL flowchart tool of which I am aware (40 years experience).
Contrary to common opinion a COBOL program can be a very complicated matter.
The essentials of COBOL are simplistic, the proper use and logic of COBOL is not.
来源:https://stackoverflow.com/questions/2602230/is-there-a-free-as-in-beer-flow-chart-generator-for-cobol-code