Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

You're going to have to be careful about this. If you translate COBOL to Perl mechanically, you're going to be churning out an awful lot of very bad Perl code. Variables in COBOL are global and the "PERFORM" statements generally involve setting a variable and having the correct global variables set when the PERFORM is done. Because COBOL was designed before structured programming was common, it typically does not support features that we today would consider good programming. As a result, an automatic translation will take COBOL and turn it into really, really bad Perl.

Unfortunately, manual translations suffer because they're so expensive and obscure business rules which have been translated into COBOL may get lost. Further, it's been my experience that the older the COBOL, the more difficult it is to follow. Trying to translate spaghetti code faithfully without realizing which code is dead can waste a lot of time.

Let's say, however, that you decide to go the mechanical translation route. How are you going to translate a COBOL table into a Perl data structure? It's certainly not a trivial task. What you would probably need to do is define a bunch of core Perl routines which duplicate common features/keywords of COBOL. COBOL's tables are one example. The UNSTRING command is another. The latter doesn't really translate well into Perl's split command, though it appears to at first glance. You'll also have to take into consideration which versions of COBOL you are using. Older versions were shy on operators, but newer versions weren't. Thus, you could have several ways of writing the same statement but you'd want to translate all of them the same way.

I would probably suggest having the COBOL replaced one program at a time and not move too fast, but that's just an ad-hoc comment given that I don't really know the full scope of your problem. Good luck!

Cheers,
Ovid

New address of my CGI Course.


In reply to Re: COBOL to Perl by Ovid
in thread COBOL to Perl by Scarborough

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-03-29 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found