Releases: bobcozzi/CGIHelper
Bob Cozzi's CGI *SRVPGM for IBM i (Free)
This is the first release of Bob Cozzi's IBM i *SRVPGM named CGIHELPER. A 3rd generation IBM i Web/CGI helper service program for Developers who need to communicate with web browsers via RPG IV.
It is a much lighter weight CGI service program than earlier options like CGIDEV2 or COZTOOLS CGILIB. This version uses fully contemporary RPG IV free-format code and logic to accomplish things that previously took dozens of lines of code and API calls.
A save file (SAVF) and the full source are both available on this release.
Download the save file, upload it to your IBM i server, then restore the CGIHELPER library (all source is included).
Then use one of the sample/demo programs in the QUSRSRC source file to see patterns for utilizing this service program.
If you want to browse the source code, I've uploaded it as well.
The DSPMSGQ program is a particularly good example.
The save file is listed below and can be download directly to your PC.
Then use FTP to upload it to your IBM i server, likely to QGPL.
Then restore the library using the RSTLIB command. Something like this:
RSTLIB CGIHELPER DEV(*SAVF) SAVF(QGPL/CGIHELPER) ALWOBJDIF(ALL) MBROPT((ALL)
The full source code is in the standard source file names, for example: RPG IV code is int the QRPGLESRC source file, while /copy and /include members are stored in the QCPYSRC source file.
Added a new cgi_ENCODHTML that calls cgi_ENCODEURI with the "HTML" parameter. Also now escapes embedded \n symbols to provide better support for output of source code to an HTML page.
Beta1
CGIHELPER *SRVPGM
An IBM i *SRVPGM that contains RPG IV compatible procedures to do basic CGI programming. This is a lightweight version that can read HTML form data from the browser and write HTML to the browser. From example to send data to the web browser you might do something like this:cgi_stdout('<p>Hello World</p>\n');
This writes the HTML paragraph with "Hello World" to the browser.
The '\n' symbol at the end of the output string is a supported symbolic version of the ASCII LINEFEED symbol. This allows you to embed linefeeds wherever and whenever you want. You don't have to worry about specifying the (often wrong) character as a Linefeed, or using complex concatenation logic to build your strings just to embed a linefeed. Simply type \n.
This version is the initial beta version but it is being used daily in production-level applications.
To install it, just download the attached save file (below) and upload it to your IBM i server, then issue the RSTLIB command.
RSTLIB SAVLIB(CGIHELPER) DEV(*SAVF) SAVF(QGPL/CGIHELPER) MBROPT(*ALL) ALWOBJDIF(*ALL)
The ALWOBJDIF and MBROPT parameters are obviously not needed the first time you restore the library, but may be important on future updates.
NOTE: While we've pretty much hardened up the parameters and procedure names, we may need to change them before the final beta or first production version is released. As unlikely as that is, be prepared in case that does happen.
Source Code and Build Routine
This beta includes the full source code. The service program is written entirely in RPG IV free format syntax and it may be created (unix nerds call it "make") by running the included BLDCGIHELP CL command (source for it is also included)..
For example: To build the CGIHELPER *SRVPGM object on your system you would run the following command:
CGIHELPER/BLDCGIHELP
A prompted version is supported and there are source lib, object lib and debug options. You can compile it into a different library if you'd like, if you do, however, you may need to do something with the /copy source members (i.e., /INCLUDE source member syntax) and the BNDDIR keyword on the included /include CGIHEADER member.