****

 

***

**** This program is a simple RPG program that demonstrates the HTTP

***

**** server APIs for reading standard input, reading an environment

***

**** variable and writing standard output. This is done using the

***

**** IBM AS/400 HTTP Server APIs.

***

****

 

***

**** The HTML at the end of this listing in CTDATA HTML is the text

***

**** that is modified by this program, written to standard output and

***

**** served to a client.

***

****

 

***

**** 1-> Create HTML document as source physical file in library.

***

**** 2-> Set Source type of HTML document to HTML.

***

**** 3-> Create the *PGM object called SAMPLE(CRTRPGMOD and CRTPGM).

***

****

-Include the service program QTCP/QTMHCGI when doing the

***

****

CRTPGM in the BNDSRVPGM or BNDDIR parameter.

***

****4-> Check QTMHHTTP or *PUBLIC has access to document and QTMHHTP1 ***

****or *PUBLIC has access to program(DSPOBJAUT and GRTOBJAUT). ***

**** 5-> Set up HTTP server configuration directives(WRKHTTPCFG)

***

**** 6-> Start the HTTP server(STRTCPSVR).

***

**** 7-> Run request from a browser.

***

****

 

***

****------------------------ IMPORTANT --------------------------------***

**** The input for this program comes from CGI standard input or

***

**** the environment variable, QUERY_STRING. For an HTTP request

***

**** method of POST, the input is read from standard input and

***

**** for an HTTP request method of GET, the input is read from

***

**** QUERY_STRING. For method POST, this program will only read 1024

***

**** characters. For method GET, the program will not read any

***

**** input data when it exceeds 1024 characters. The QtmhGetEnv

***

**** API will set the length of the environment variable response

***

**** to the actual length and no data is read into the receive

***

**** buffer.

***

****------------------------ IMPORTANT --------------------------------***

****

 

***

**** Sample html form segment to run this sample CGI script:

***

****

 

***

****

.

***

****

.

***

****

.

***

**** <form action="/cgi-bin/sample" method="POST">

***

**** <input type="Text" maxsize=80 size=20 name="Sample">

***

**** <input type="Submit name="SampleData" value="Submit CGI script">

***

**** <br>Sample CGI program written in RPG.<br>

***

**** Type data and Click Submit to run a Sample program using RPG.

***

**** </form>

***

****

.

***

****

.

***

****

.

***

****

 

***

**** HTTP Server configuration:

***

**** # Pass the html document in a library

***

**** Pass /sampledoc /qsys.lib/websamp.lib/htmlfile.file/sample.mbr

***

**** # Allow CGI program to run.

***

**** Map

/cgi-bin/* /cgi-bin/*.pgm

***

**** Exec /cgi-bin/* /qsys.lib/websamp.lib/*

***

****

 

***

**** This program is invoked by a URL from a browser in the form:

***

**** http://hostname/sampledoc

***

****

 

***

**************************************************************************

****

 

***

**** Function of this SAMPLE program:

 

***

**** Sample ILE RPG AS/400 program to demonstrate AS/400 HTTP server

***

**** CGI program. It reads data from standard input based on the

***

**** Content_Length environment variable.

The QtmhGetEnv System API

***

**** is used to get the Content_Length and

set the InDataLn variable

***

**** used by the QtmhRdStdIn API. The data

to be returned to the

***

100Web Programming Guide V4R5

Page 110
Image 110
IBM AS/400E manual Create the *PGM object called Samplecrtrpgmod and Crtpgm

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.