contents.gifindex.gifprev1.gifnext1.gif

What is CGI?

CGI stands for the Common Gateway Interface. CGI is simply a standard by which a Web server communicates with an external program. CGI programs, also known as scripts, can be written in any language, so CGI lets you take advantage of your ACUCOBOL-GT programming experience.

By writing CGI programs in a language you already know, you have to learn only what the Web server expects, and how it formats messages that it passes back and forth across the network. On top of providing cross-platform portability, ACUCOBOL-GT CGI programs do not require any special plug-in or applet when interfacing with a browser.

In addition, your CGI program is compiled when it is written in ACUCOBOL-GT. This not only speeds up processing, but it reduces the size of the finished product, and secures your program from anyone who might try to acquire and modify it. Your CGI program is not sent across the Internet -- only the data (if any) and response (if any). Users won't know if your CGI program is written in COBOL or another language. All that they see is the results.

The flow of typical CGI programs is as follows:

1. From a client machine, typically a Web browser, a form or query is sent to the Web server. The user might launch a request by pressing a button on your Web page (HTML form).

2. The Web server then forwards the request to the CGI program, in this case, written in ACUCOBOL-GT. This program ACCEPTs the CGI data sent by the client into an external form which you define in working storage.

3. The request is either processed by the CGI program itself, or passed to another ACUCOBOL-GT program for execution.

4. The CGI program uses the DISPLAY verb to merge processing results with an HTML template, and sends the result to the Web server in the standard output stream. The ACUCOBOL-GT runtime creates and outputs the appropriate HTTP response headers automatically.

5. The Web server sends the HTTP response header followed by the HTML content message to the user's machine where it is displayed inside the browser window.

It is important to note that any and all connectivity options generally available to Acucorp customers can be applied in the third step if desired. For instance, the CGI program can CALL a remote program using AcuConnect for connectivity. Likewise, the CGI program or CALLed program can access any file system or database that Acucorp supports to perform a lookup. If the file system resides on another machine, the program can use AcuServer to achieve access. If a relational database access is desired, Acu4GL(TM) can be used to translate the request into SQL automatically.