contents.gifindex.gifprev1.gifnext1.gif

Functions of a CGI Program

There are three basic functions of a CGI program:

1
Read CGI input data from the client. Each element of your HTML form interface has a corresponding CGI variable. When a user enters information onto the form, that information is sent to the CGI program in the form of CGI data. Your program must be able to read CGI input data. In ACUCOBOL-GT Version 4.0 and later, this is accomplished with the ACCEPT verb.

2
Process the input data and arrive at results. Typically, this involves either a calculation, database lookup, or file read, but it could involve a CALL to an existing COBOL program on a local or remote machine.

3
Generate output that can be read by the client browser. Minimally, this includes an HTTP response header with a URL pointer to the response data. Otherwise, the header may be followed by response data formatted with HTML. In ACUCOBOL-GT Version 4.0 and later, HTTP output is accomplished using the DISPLAY verb.

In the simplest case, your ACUCOBOL-GT CGI program can contain one ACCEPT statement and one DISPLAY statement. Even if your program is more complicated, it will always start with an ACCEPT and end with a DISPLAY. Few languages make CGI programming so simple.

See Also

int90002.gif Sample CGI Program

int90002.gif CGI Guidelines