COBOL Source Viewer

A set of Perl scripts that will wrap your COBOL source code in HTML so that you can view it in a web browser


My interest in Perl started when I became frustrated with the limitations of the IBM mainframe code editors when trying to review COBOL code. So I decided to write a set of scripts that would wrap COBOL source in HTML so that it could be viewed using a ‘web browser’. The result was two scripts that created a set of files that enabled the main program source and its associated copybooks to be viewed. does most of the work - it takes a ‘cobol’ source file (a text file) and inserts appropriate html tags to enable it to be viewed using a web browser (Chrome / Firefox etc.

It should be noted that these scripts were some of the first I developed and as such (at least currently) do not follow any best-practice / standards etc. Changes are currently underway to improve the structure of the scripts and the design of the user interface.

Updates : the script has been updated so that input / output details are stored in a config file, styling is now provided by Bootstrap and scrolling up /down when 'clicking' on a link is smooth (smoothScroll.js). For the moment the keyword highlighting has been removed (need to work out how to do this properly).

ToDo :-
  • replace Bootstrap styling - useful for an initial demo but not required - updates to styles.css
  • integrate the copybook processing into the main script
  • display copybooks members in a sliding panel - from the right - when selected


  • Get Perl - or ensure that your version of Perl is reasonably up-to-date.
  • Ensure that the 'output' folder contains the supplied css / js folders (and files).
  • Place all your COBOL code in an appropriate folder and update the config file (*.cfg) as required.
    i_path /home/demo/tmp/csv/src/
    o_path /home/demo/tmp/csv/html/

To run the scripts :-

    perl --config='csv.cfg'


The following assumptions are made :-

  • all the COBOL source files are stored with a '.cbl' / '.CBL' extension
  • the supplied paths to the source files must be full paths - relative paths may not work
  • the COBOL code is properly structured (SECTIONS ...) and that the proper conventions are followed with regard to what can be placed in Area A / B etc.