Can you summarize the steps I have to go through
in writing my first CGI?
Suppose the following:
Proceed as follow:
- your images (gif's, jpg's, etc.) will reside
in an IFS directory named myobjlib
- your source library is named mysrclib
- your object library (the one to contain
your dynamic HTML scripts, your CGI programs,
and Mel Rothman's service program CGISRVPGM)
is named myobjlib
- your first CGI program is named MYCGI1
- Set up your CGI source and object libraries
by entering command
CGIDEV2/SETCGILIB SRCLIB(mysrclib) PRDLIB(myobjlib)
For information on this command please see
Obtain a sample external html source and
a sample CGI RPG source
by using command
- Note 1-
Command SETCGILIB -
when run from a user profile with
on the HTTP configuration file
will show you a list of the configuration files for the existing HTTP instances.
If you select with a "1" a given HTTP instance,
the program will add - to the configuration file of that HTTP instance - the HTTP directives needed to run
your CGI programs in library myobjlib.
CGIDEV2/CRTCGISRC SRCMBR(mycgi1) SRCLIB(mysrclib) PRDLIB(myobjlib)
You may compile the module,
create the CGI program and run it.
Afterwards you may change both the external HTML
and the CGI program to fit your needs.
- Note 1.
To create the module use commnad
and do not forget to specify
I would also recomment that you change the default value
of this parameter once for ever entering command
CHGCMDDFT CMD(CRTRPGMOD) NEWDFT('dbgview(*source)')
- Note 2.
To create the CGI program, use command
as specified in the initial comments of the
- Note 3.
To run your CGI, use the instructions
specified in the initial comments of the
If you receive Error 500,
this means that either your program was not found,
or that it bumped out during execution.
In this case, get prepared for debugging reading
- Note 4. See
for more information on how to divide this script
into record-formats or sections
and on how to define output variables.