Top
NetCOBOL V11.0 CGI Subroutines User's Guide
FUJITSU Software

6.1 Use of the Sample Program

Simple questionnaire using CGI subroutines

This example is a program that exchanges information between a WWW Server and a WWW Browser by using CGI subroutines.

Outline

The Entry Field, Check Box, and Radio Button values are received from the WWW browser, a Web page for processing result output is created on the WWW server according to the received information, and the created Web page is displayed on the WWW browser.

Supplied programs

CGI subroutines used

COBW3_INIT, COBW3_GET_VALUE, COBW3_SET_CNV, COBW3_PUT_HTML, COBW3_PUT_TEXT, and COBW3_FREE

Program compilation

Compile the program by using the COBOL32 command in which the -M option and -I option (for specifying the folder for storing the CGI subroutine library) are specified.

The -I option need not be specified if the CGI subroutine library file (COBW3.cbl) was already copied from the COBOL-installed folder to the current folder.

COBOL32 -M -I"C:\Program Files\Fujitsu NetCOBOL for Windows\COBOL" CGIBASIC.COB

Program linkage

Import libraries F3BICWSR.LIB, F3BICIMP.LIB, and MSVCRT.LIB are added.

LINK /OUT:CGISMP01.EXE CGIBASIC.OBJ F3BICWSR.LIB F3BICIMP.LIB MSVCRT.LIB

Conditions for program execution

The path to the Web application for which the FORM tag ACTION attribute is specified in the Web page for invoking the application (CGISMP01.HTM) must be changed to a virtual path on the WWW Server to be actually used.

Program execution

Copy the CGISMP01.EXE, SAMPLE01.HTM, SAMPLE01_1.HTM, and COBOL85.CBR files to the specified folder on the WWW Server.

From the WWW browser, enter the URL of the WWW Server and specify SAMPLE01.HTM. A simple questionnaire screen is displayed.

Enter or select necessary data, and click the [Invoke CGI Program] button. The entered data is sent to the WWW Server, and the processing result is displayed on the WWW Browser.

To cancel the entered data before the data is sent to the WWW server, click the [Reset Values] button.

The processing result HTML Web page should be displayed noting which data you entered and which check box and radio button you selected.