**** client to written to standard output using the QtmhWrStOut API. ***
**** The data will be returned as text/html. ***
**** ***
**************************************************************************
* Variables for the CGI interface API for QtmhRdStIn.
DBufIn S 1024a INZ
DBufInLn S 9b 0 INZ(1024)
DStdInLn S 9b 0
**************************************************************************
* Variables for the CGI interface API for QtmhGetEnv.
DEnvRec S 1024A INZ
DEnvRecLen S 9B 0 INZ(1024)
DEnvLen S 9B 0 INZ
DEnvName S 25A INZ('CONTENT_LENGTH')
DEnvNameLen S 9B 0 INZ(14)
**************************************************************************
*Variables for the CGI interface API for QtmhWrStout.
DBufOut S 2048a INZ
DBufOutln S 9b 0
*************************************************************************
*** Data structure for error reporting. ***
*** Copied from QSYSINC/QRPGLESRC(QUSEC). ***
*** The QUSBPRV must be initialized to 16. ***
*** This is the common error structure that is passed to the CGI APIs;***
*** QtmhWrStOut, QtmhRdStin, QtmhGetEnv and QtmhCvtDb. The Error ***
*** structure is documented in the "AS/400 System API Reference". ***
*************************************************************************
DQUSEC DS
D* Qus EC
D QUSBPRV 1 4B 0 INZ(16)
D* Bytes Provided
D QUSBAVL 5 8B 0
D* Bytes Available
D QUSEI 9 15
D* Exception Id
D QUSERVED 16 16
**************************************************************************
*** Constants for names of CGI APIs. ***
DAPIStdIn C 'QtmhRdStin'
DAPIStdOut C 'QtmhWrStout'
DAPIGetEnv C 'QtmhGetEnv'
**************************************************************************
* Prototype for c2n procedure that converts content length to numeric. ***
Dc2n PR 30p 9
Dc 32 options(*varsize)
**************************************************************************
* Compile-time array for HTML output. ***
Darrsize C 23
Dhtml S 80 DIM(arrsize) PERRCD(1) CTDATA
DContentLn S 9B 0 INZ(0)
DEnvCL S 20A INZ('CONTENT_LENGTH')
DEnvSS S 20A INZ('SERVER_SOFTWARE')
DEnvMethod S 20A INZ('REQUEST_METHOD')
DEnvQS S 20A INZ('QUERY_STRING')
DEnvMDResp S 30A INZ
DEnvSSResp S 50A INZ
DEResp S 4A INZ
D**************************************************************************
D* Define line feed that is required when writing data to std output. ***
Dlinefeed C x'15'
Dbreak C '<br>'
Dmaxdataln S 4B 0 INZ(1024)
D**************************************************************************
D* Some local variables used for adding newline in std output buffer. ***
Dcnt S 4B 0 INZ(1)
DWORK2 S 80A INZ
DResult S 9B 0 INZ
Chapter6. Sample programs (in Java, C, and RPG) 101