How do I run CGI programs?

CGI programming dates from HTML/HTTP circa 1996 and is extremely inefficient.  CGI applications necessarily result in a new "process start" (COBOL program execution) for every Web page processed by a Web server.  Such environments can only sustain 5-10 concurrent COBOL programs at once and, if the programs use files with file-level locking, concurrency is reduced to 1 concurrent Web page request.  

Although it is still possible to write and use Elastic COBOL applications in a CGI environment (they DISPLAY HTML text UPON SYSOUT and parse environment variables such as QUERY_STRING on input), it is not encouraged.  

Instead, traditional CGI programs can be converted to Java servlets, exported as Web Application Archives (.war) and deployed to the lightweight servers accustomed to handling "servlets", such as the Apache Tomcat. Web server.   Tomcat is a "lighter" form of Web server than a full-blown Java Application Server used to run, for example, CICS transactions using Geronimo, IBM Websphere or Oracle Weblogic.  Tomcat manages state from Web page to Web page allowing COBOL servlets to function like Java servlets in use throughout the Web resulting in efficient Web applications.

See the Elastic COBOL examples "Register Servlet", "Counter Servlet" and "Snooper Servlet".  See the section "Servlet Applications" beginning on page 33 of the Elastic COBOL Getting Started Guide for instructions on how to prepare and deploy the "Register Servlet."    Instructions on how to start the Apache Tomcat server are on the preceding page.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk