*********************************************************************
* RPG ILE MODULE CGIDEV2/HELLO1
*
* After compiling this RPG MODULE,
* create the related program with the following command:
*
* CRTPGM CGIDEV2/HELLO1 MODULE(CGIDEV2/HELLO1) ACTGRP(C2HELLO1)
*
*********************************************************************
* Input HTML parameters
*
* VARIABLE MEANING
* firstname= first name
* lastname= last name
*
*********************************************************************
/copy CGIDEV2/qrpglesrc,hspecs
/copy CGIDEV2/qrpglesrc,hspecsbnd
*--------------------------------------------------------------------
* Variables common to all CGIs
*--------------------------------------------------------------------
/copy CGIDEV2/qrpglesrc,prototypeb
/copy CGIDEV2/qrpglesrc,usec
/copy CGIDEV2/qrpglesrc,variables3
* External HTML
D extHtml s 2000 inz('/cgidev/html/hello1.txt')
* Indicators for GetHtmlIfsMult subprocedure
D IfsMultIndicators...
d ds
D NoErrors n
D NameTooLong n
D NotAccessible n
D NoFilesUsable n
D DupSections n
D FileIsEmpty n
* Variables parsed from input query string
D firstName s 40a
D lastName s 40a
* Other variables
D OSRls s 9a
D qccsid s 5a
*=====================================================================
* PROCESS
*=====================================================================
* Write qualified job name to debug file (optional). The *on
* parameter forces output even if debugging is off.
* Remove this parameter or change it to *off if you
* want the output only if debugging is on.
C callp wrtjobdbg
* Receive query string from the browser
/copy CGIDEV2/qrpglesrc,prolog3
* Parse it into program variables
C eval firstName = zhbgetvar('firstname')
C eval lastName = zhbgetvar('lastname')
* Load external HTML
C eval IfsMultIndicators = getHtmlIfsMult(
C %trim(exthtml):'')
* Retrieve current OS/400 release
/free
OSRls=RtvOsRls();
/end-free
* Set html output variables
C exsr SetVar
* Send sections
C callp wrtsection('top')
C* callp wrtsection('blabla')
* Quit
C exsr Exit
*=====================================================================
* Close output html and quit
*=====================================================================
C Exit begsr
* Do not delete the call to wrtsection with section name *fini. It is needed
* to ensure that all output html that has been buffered gets output.
C callp wrtsection('*fini')
* Quit
C return
C endsr
*=====================================================================
* Set HTML output variables
*=====================================================================
C SetVar begsr
* First name (and clear all HTML output variables)
C callp updHTMLvar('FIRSTNAME':firstname:
C '0')
* Last name
C callp updHTMLvar('LASTNAME':lastname)
* Current OS/400 release
C callp updHTMLvar('OSRLS':OSRls)
*
C endsr
|