Chapter 5. Enabling your AS/400 to run CGI programs

How to enable the server to run CGI programs .

. 85

Explicit CGI enablement

. .

.

. 87

Using directives for security and access control .

.

86

Server runs only CGI programs. . .

. .

.

.

87

The default fail rule

.

87

CGI program considerations

. .

.

.

87

This chapter discusses the specific steps you need to take to enable your AS/400 for Common Gateway Interface (CGI) programs.

How to enable the server to run CGI programs

AS/400 stores some CGI programs in QSYS.LIB. You can write the programs in C++, Rexx, Java, ILE-C, RPG, or COBOL. If the UserID directive is not active, the server profile QTMHHTP1 needs access to the *PGM object and all objects the program accesses. If the UserID directive is active, the UserID profile needs access to the *PGM object and all objects the program accesses. The Exec directive is required in the HTTP configuration to run a CGI program on the server.

Here is a summary of the steps you need to take to enable your AS/400 system to run CGI programs:

1.Decide for which CGI mode you will write your program.

2.Write the C++, Rexx, Java, ILE-C, RPG, or COBOL program.

3.Compile your program.

4.Create the program object using CRTPGM. Add the Bind Service program, QHTTPSVR/QZHBCGI when the program uses the server APIs (QtmhWrStOut, QtmhRdStdIn, QtmhCvtDB, QtmhGetEnv, QtmhPutEnv QzhbCgiParse, or QzhbCgiUtils).

5.Using the WRKHTTPCFG command, add an Exec directive that either specifies the actual library where the program is stored or maps to the library where the program is stored. Specify the CGI mode for your program. The following directive is the library where the program is stored and also indicates to the server to use EBCDIC mode:

Exec /QSYS.LIB/nnnnnnnn.LIB/* %%EBCDIC%%

Where nnnnnnnn is the library where the CGI program is stored.

The following directive maps to the library where the program is stored.

Exec /CGI-BIN/* /QSYS.LIB/nnnnnnnn.LIB/* %%EBCDIC%%

The advantage of using the mapping directives is that the actual location of documents and programs is masked. Also, by setting the /cgi-binvalues correctly for Pass, Exec and Redirect, there is less chance of finding the wrong directive.

Access to program object is *USE for QTMHHTP1 or *PUBLIC. You must set *USE for QTMHHTP1 for the access to the program object, or you must specify a user ID on a Userid directive in the server configuration. Setting the access to *PUBLIC *USE would enable the server to run the CGI program, regardless of whether you specify a user ID in the server configuration.

6.Store the HTML file on the AS/400 system by doing one of the following, depending on the file system in which you wish to store the document:

v To store it in the AS/400 Source physical file:

© Copyright IBM Corp. 1997, 2000

85

Page 95
Image 95
IBM AS/400E manual Enabling your AS/400 to run CGI programs, How to enable the server to run CGI programs

AS/400E specifications

The IBM AS/400E, now more commonly known as IBM i, is a robust and versatile midrange server that has been designed to provide a comprehensive computing solution for businesses of all sizes. First introduced in the late 1980s, the AS/400 series has undergone multiple enhancements and rebranding, with the AS/400E being one of the notable iterations. This powerful platform is closely associated with IBM's commitment to reliability, scalability, and integrated business solutions.

One of the main features of the AS/400E is its highly integrated architecture that combines hardware and software into a cohesive system. This integration allows for seamless operations, reducing the complexity typically associated with managing disparate systems. The system is powered by IBM's proprietary OS/400 operating system, which has evolved into IBM i, featuring advanced capabilities like object-oriented programming, integrated database management, and security features that are essential for enterprise environments.

A key characteristic of the AS/400E is its robust database support, primarily through the use of DB2 for i. This integrated database management system enables efficient data handling and retrieval, facilitating real-time business analytics and reporting. Furthermore, the platform supports a variety of programming languages, including RPG, COBOL, and Java, making it flexible for developers who require diverse tools for application development.

The AS/400E is also known for its exceptional reliability and uptime, making it a preferred choice for critical business applications in industries such as finance, healthcare, and manufacturing. This reliability is backed by advanced error detection and correction mechanisms, as well as redundancy features that help prevent data loss and minimize downtime.

In terms of scalability, the AS/400E can effortlessly expand to accommodate growing business demands. Organizations can increase processing power by adding more resources without significant disruption. This scalability, combined with the system’s built-in virtualization capabilities, allows businesses to optimize resource usage and streamline operations.

Security is another defining feature of the AS/400E. The platform incorporates various layers of security measures, including user authentication, encryption, and comprehensive auditing capabilities, ensuring that sensitive business data is protected against unauthorized access.

Overall, the IBM AS/400E remains a powerful tool in the enterprise computing landscape, providing businesses with an integrated, reliable, and secure solution for their technological needs. Its enduring popularity is a testament to its capability to evolve with changing business requirements while maintaining its core attributes of high performance and stability.