Skip to main content

Problem:

There are two methods of starting a COBOL  CGI application, one popular method is to cretae a shell script which is invoked by the httpd web server. The subject of this document is how to debug the COBOL application which is ececuted from within this shell script.

Resolution:

The first requirement is that the application program(s) must be compiled for animation. This is  accomplished through flags or options specified at compile time. For .int programs the flag is '-a' for .gnt, callable shared objects, or UNIX executables the flag is '-g'.

All httpd web servers run under a user-id specified in the web server configuration by the server administrator. CGI scripts or programs loaded/invoked by the web server run under this same user-id. For example the administrator might set up the server so that it runs under the user-id of 'wwwrun'. All processes run by the web server will be owned by 'wwwrun'

In order to use the animator to debug an application process owned by 'wwwrun'  you will need to login on a character mode terminal using the same user-id. Once logged in setup the environment for Server Express (COBDIR,PATH, and the Library path variable for the operating system)

Modify the triggering script adding the definition for a variable named COBANIMSRV, for example

export COBANIMSRV=cgidebug

In the character mode terminal session set the same environment variable to the same value and change directory to the location for the COBOL CGI program files and .idy files. Now issue the command: 'cobanimsrv'

The terminal will appear to be waiting for some event with no obvious activity occuring, in fact the Server Express animator is waiting for the COBOL CGI program to be invoked.

Open the web page that drives the CGI application in a web browser, fill in the form fields and submit the form to the web server.

As soon as the CGI program starts to run the Server Express Animator will opened using the character mode terminal screen. Step through the COBOL application using the Animator and debug the program.

Note that the web browser may 'timeout' while your debugging, reporting that the web server has not responded.

Old KB# 2304