Skip to main content  
  Easy400   |       IBM System i home   |   RSS feed
Main utilities
5250 utility
Windows utility
Service program
Sample code
CGI support
Self maintenance

CGI support

CGI programs based on the CGIDEV2 ILE-RPG CGI Development Toolset may also take advantage of MIME & Mail services, thus providing integration between WEB and E-mail.

As any other ILE-RPG programs, a CGI's may

Equipping a CGI library with the SENDMAIL service program
For a CGI library to be able to use MIME & Mail service program, the following is needed:

  • Service program SENDMAIL must be duplicated in the CGI production library
  • The binding directory TEMPLATE2 in the CGI production (object) library must be added an entry pointing to the SENDMAIL service program
  • Member MAILPROTO must be copied from MMAIL/QRPGLESRC to the QRPGLESRC file of the CGI development (source) library
All this can be done through command mmail/setcgilib.

/COPY statements to include in a CGI
The following /COPY statements are needed (assume that MYLIB is the name of your CGI source library):
 /copy MYLIB/qrpglesrc,hspecs
 /copy MYLIB/qrpglesrc,hspecsbnd
 * F-SPECS go here
 /copy MYLIB/qrpglesrc,prototypeb
 /copy MYLIB/qrpglesrc,usec
 /copy MYLIB/qrpglesrc,variables3
 * D-SPECS go here

Execution of MMAIL commands within CGI's
Library MMAIL must be in the CGI job library list before any MMAIL command is executed. This can be obtained through the doCmd subprocedure. Example:
C                   eval      rc = docmd('addlible mmail')
C                   eval      rc = docmd('emlspl ...')
C                   eval      rc = docmd('rmvlible mmail')

Spool file management within CGI's

  • To enable a CGI to have full control on a spool file generated from it, the printer file must be overrided with parameter SPLFOWN(*JOB).
    Besides, if the spool file must be converted to PDF via INFOPRINT, the output queue must be defined with AUTCHK(*DTAAUT).
  • Spool files may optionally be converted to PDF's. This can be done either using the mimeSplPdf subprocedure or running the emlspl command.
    If you plan to have CGI's running spool file conversion based on INFOPRINT, then you must run once command MMAIL/QTMHHTP1.