Manta alt


You must allow the browser to execute JavaScript programs if you want to view product information. If your browser is set up to execute JavaScript programs, the problem is that the product ID was incorrect. Use the menu bar above to find the desired product.


For an ebusiness application to be useful to most organizations, it must be able to display and/or update data stored on the organization's production system. This course shows you how to develop fully functional ebusiness solutions using nothing more than your existing knowledge of RPG and the web facilities already included in IBM i.

The course begins by describing the structure of a CGI program and the application programming interfaces (APIs) that allow an IBM i program to communicate with the HTTP server. You will then see how to incorporate these APIs into an RPG program to receive data from and pass data to a web browser. The RPG code that is developed during this course is then combined into a complete application. The course ends by presenting tips and techniques for setting up the RPG CGI programming environment.

Approximate Study Time: 2-3 hours


After completing this course, you should be able to:

  • Identify the environment information that is available to a CGI program
  • Name and describe two ways in which data from a web user can be passed to a CGI program
  • Interpret the data string that is passed from an HTML form to a CGI program
  • Order the major steps performed by a CGI program
  • Code the CALLB and PARM statements to invoke the APIs used to read input from or write output to a browser
  • Code the CALLP statement to invoke the APIs used to read input from or write output to a browser using a prototyped call
  • Describe ways in which the calls to an API can be packaged for easier use within an RPG program
  • Identify special considerations for generating HTML statements from within a CGI program
  • Describe the steps needed to retrieve data from a form that was passed using either the GET or POST methods
  • Identify the API and parameters used to write standard output, retrieve environment variables, read standard input, or convert the data string sent by a browser into RPG data items
  • Describe the process used by QtmhCvtDb to convert the data string sent by a browser into RPG data items
  • Describe situations in which additional work may be necessary to prepare form data for use by an RPG program
  • Describe the reasons for specific HTML attributes, RPG keywords, and RPG statements in a given CGI application
  • Identify the IBM i commands used to set up the CGI programming environment
  • Identify the user profile that must be granted authority to call a CGI program
  • Code the H-spec keywords to bind a service program with an ILE RPG program
  • Describe how the use of a named activation group improves the performance of a CGI program
  • Create a service program that includes procedures which use the CGI APIs

Topic Outline

The Structure of a CGI Program

Creating HTML Output

Getting the Input Data

Parsing the Input String

Putting it All Together

Setting Up the CGI Program Environment


This course should be taken by RPG programmers responsible for creating CGI programs.


This course assumes that you have a working knowledge of RPG programming in the ILE environment. You can satisfy this prerequisite by successfully completing the Manta RPG Programming series.

In addition, you should have an understanding of the role of HTML, JavaScript, and CGI programs in an ebusiness environment and how forms are defined and used in an HTML/XHTML document. These prerequisites can be satisfied by completing the previous courses of this series:

You may also have obtained these skills by taking other courses or through relevant work experience.