Is there a free (as in beer) Flow chart generator for COBOL Code?
Solution 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
Solution 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.
Solution 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!
Solution 4
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.
Solution 5
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.
btelles
Updated on June 26, 2022Comments
-
btelles almost 2 years
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?
-
btelles about 14 yearsThanks for the support. I have about many thousands of lines of code to look at though, and although I would love learning COBOL, it's more a matter of time and direct business ROI at this point. Do you happen to know of any flow generators like the one mentioned above?
-
brydgesk about 14 yearsSorry, I've never used or seen any flow generators, let alone free ones. I understand the ROI issue though, COBOL usually sticks around so long and works so well that it rarely feels worth the time and effort to replace it. Of course, once all the COBOL programmers are gone we're in trouble.
-
David Thornley about 14 yearsCOBOL is not a complicated language, and I suspect learning it would be faster than automatically translating it to source code and then trying to read flow charts. Helpful hint: if you think a language construct you see is too dumb to exist, and must have a deeper meaning, and you're in a COBOL program, you're wrong.
-
NealB about 14 yearsWhy not just post your code on a public code snippit site and give a link to it?
-
synasius about 14 yearsHey, you're right! Here it is codepad.org/0sXIwrp2
-
synasius about 14 yearsI forget to tell you that my script doesn't catch call to external routines, cause in our cobol software every call is under a label.. so i just catch all labels; it works for my purpose
-
Ira Baxter almost 14 years... and it handles PERFORM statements correctly? Fall throughs from one paragraph A into another B, in the face of PERFORM B? COBOL's control flow is a lot trickier that you might think.
-
Ira Baxter almost 14 yearsThe bit about COBOL not being describable by any LR(k) is just wrong, especially if you are willing to do the same kind of things that the GNU guys were willing to do parse C++ with Bison. COBOL is relatively easy to parse with GLR parsers even without those hacks (I have a production IBM Enterprise parser built this way). I agree, you're not likely to find a good one of these for free.
-
Ira Baxter almost 14 yearsHere's a reliable COBOL flowcharter: (See Example COBOL Control Flow Graph) on this page: semanticdesigns.com/Products/DMS/FlowAnalysis.html. (Its not free).
-
NealB almost 14 years@Ira Baxter. Point well taken, GLR parsers do solve the problem, I was thinking along the lines of classical LR parsers where reasonable values for K are small. Now, exactly how long did it take you to write a GLR parser for IBM Enterpise COBOL? Were there many late nights or foul language involved?
-
Ira Baxter almost 14 yearsWe are building a parsing/transforming toolkit called DMS semanticdesigns.com/Products/DMS/DMSToolkit.html. We built for DMS a parser generator system for GLR and use that for many langauge definitions, so its cost is amortized and pretty reasonable. WRT IBM Enterprise COBOL, our GLR parser is just like having Bison off-the-shelf. Yes, there were many late nights and foul language involved, but it had nothing to do with the parser. Rather, it had to do with the imprecision of IBM documents describing the details of Enterprise COBOL. This is where the real pain is.
-
Ira Baxter almost 14 years...moral: you really don't want to build your own COBOL parser for a one-off tool. And it isn't the parsing technology that is the problem, although if you use a weaker technology it will add to your troubles some. But it isn't the principal source of the problem.
-
synasius almost 14 yearsyes it handles PERFORM statement! But if you have "PERFORM LabelA THROUG LabelB" under LabelC you only get a link from LabelC to LabelA. This is because in our software we use PERFORM THROUG statement only when LabelB is an exit label. As i told before this script is specialized to work with our software, but i think can be easily modified so that best fits your needs, since python it's an easy to use language.
-
nav100 over 13 yearsSynasius, I am in the same boat. I have installed Python with yapgvb module. I tried to run your file at the command prompt C:\Python27\Python raw.py test.CBL I received 'NotImplemented error'. I have no idea about Python. Could you post more instructions how to run this file. I appreciate your help.