gouse_baig has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am very new to perl. I need help to write a perl script for the following purpose,

To extract Metadata from COBOL source code. This script will read the COBOL file , looking for reserved words and based on the COBOL syntax rules, will identify the Metadata to extract. The extracted MetaData will be written to a text file where data will be delimited by "|" Symbol. The Reserved Words of COBOL will be placed in a config file.

Example for Reserve Words: ACCEPT AUTHOR FD INPUT ..etc..

I am Wondering how to start and where to Start the program. Can any one help me on this . Please give your valuable guidence to me.

Thanks in advance.
Baig.

Replies are listed 'Best First'.
Re: Parsing Cobol Program
by talexb (Chancellor) on Jun 20, 2003 at 14:57 UTC

    Hi, and welcome!

    I can suggest two options:

    • Write your own parser
    • Use something like Parse::RecDescent which is a general parser
    If you are new to Perl, this site is a great resource, but you should also have some Perl books to hand. The O'Reilly books are terrific and I highly recommend them.

    --t. alex
    Life is short: get busy!

      Both of these might be assisted by the COBOL grammar which can be found here :-)

      /J\
      
      Thanks alex
      I will try to write my own parser.


      baig.