User Functions

Older Stories

Welcome to Sunday, 24 September 2017, 12:18 @ CEST

cgi interface

cgi for cobol
  • Tuesday, 19 April 2016, 10:25 @ CEST
  • Contributed by:
  • Views:

Cobol is mainly used in a business environment where architectures use the IPO principle: Input some data (records in a file), process them and output them (print records). Off course, this is a very simplistic view.  

This IPO principle is still found in most modern system architectures and is sometimes synonimized with client-server architecture.  Fact is that input forms got smart as http-requests, and printed reports went also intelligent in the form of html-pages. From a Cobol perspective these smart entities are a foreign concept since they are in free format. 

And we want Cobol to interface with these smart entities, don't we? While Cobol is based on fixed length data, it looks like mission impossible to introduce variable-length string manipulation needed for interfacing with current software protocols, like http and https.

The Internet and its protocols, however, offers exactly this (IPO) environment when you visually think of the webserver as the operating system.

So, having the requirement to run Cobol software on the web implies the ability to read a external form, process its data and print some report that is rendered externally. Some compilers have implemented such interface with ACCEPT and DISPLAY (as opposed to READ and WRITE). The references to the external entities are implemented using the long-known CGI interface (http-requests with GET and POST) and generating html-pages from templates.  

Which summarizes the problem statement

  1.     get Cobol software running on the web, 
  2.     interfacing with http-requests as input and
  3.     generating html-pages to be rendered by the (client) browser.

In order to solve this problem, we could use a library for CGI and a library for a template engine. The implementation effort is reduced to interfacing with these libraries. We will see that this is impossible in pure Cobol, but made easy when the compiler talks C and by developing a few wrappers.

Reference, quoted from [Acucobol GT reference manual](

The following comments are owned by whomever posted them. This site is not responsible for what they say.