000100      *====================================================================                            000000
000200      *  RPG ILE XLSCGI/SAMPLECGI1                                                                     000000
000300      *  Outputs an HTML table                                                                         000000
000400      *                                                                                                000000
000500      *  CRTBNDRPG PGM(XLSCGI/SAMPLECGI1) DFTACTGRP(*NO) ACTGRP(SAMPLECGI1) DBGVIEW(*LIST)             000000
000600      *                                                                                                000000
000700      *====================================================================                            000000
000800      /copy xlscgi/qrpglesrc,hspecs                                                                    000000
000900      /copy xlscgi/qrpglesrc,hspecsbnd                                                                 000000
001000     FSAMPLEFILEif   e           k disk    usropn                                                      000000
001100     F                                     extfile('XLSCGI/SAMPLEFILE')                                000000
001200      /copy XLSCGI/qrpglesrc,prototypeb                                                                000000
001300      /copy XLSCGI/qrpglesrc,XLSCGIPROT                                                                160512
001400      /copy XLSCGI/qrpglesrc,usec                                                                      000000
001500      /copy XLSCGI/qrpglesrc,variables3                                                                000000
001600      * Input variables                                                                                000000
001700     D xrequest        s             10                                                                000000
001800     D extHtml         s           2000    varying                                                     000000
001900      * Indicators for GetHtmlIfsMult subprocedure                                                     000000
002000     D IfsMultIndicators...                                                                            000000
002100     d                 ds                                                                              000000
002200     D  NoErrors                       n                                                               000000
002300     D  NameTooLong                    n                                                               000000
002400     D  NotAccessible                  n                                                               000000
002500     D  NoFilesUsable                  n                                                               000000
002600     D  DupSections                    n                                                               000000
002700     D  FileIsEmpty                    n                                                               000000
002800      *                                                                                                000000
002900      *========================================================================                        000000
003000      * Main line                                                                                      000000
003100      *========================================================================                        000000
003200      /free                                                                                            000000
003300                                                                                                       160512
003400           fixJobCCSID();  //change job CCSID if 65535                                                 160512
003500           SetNoDebug(*on);   //do not write records to file CGIDEBUG                                  160512
003600                                                                                                       160512
003700           //Get input                                                                                 160512
003800             nbrVars = zhbgetinput(savedquerystring:qusec);                                            160512
003900           //Get input variables                                                                       160512
004000             xrequest = zhbgetvarupper('xrequest');                                                    160512
004100                                                                                                       160512
004200           //Load external HTML                                                                        160512
004300             exthtml ='/xlscgi/html/samplecgi1.htm';     //HTML sections                               160512
004400             IfsMultIndicators = getHtmlIfsMult(exthtml:'<as400>');                                    160512
004500                                                                                                       160512
004600           //Open file                                                                                 160512
004700             if not %open(samplefile);                                                                 160512
004800                open samplefile;                                                                       160512
004900             endif;                                                                                    160512
005000                                                                                                       160512
005100           //Start output table                                                                        160512
005200             wrtsection('top');                                                                        160512
005300                                                                                                       160512
005400           //Write table rows                                                                          160512
005500             samppartno=*loval;                                                                        160512
005600             setll samppartno samprcd;                                                                 160512
005700             read samprcd;                                                                             160512
005800             dow not %eof;                                                                             160512
005900                 updhtmlvar('samppartno':samppartno);                                                  160512
006000                 updhtmlvar('sampdescrn':sampdescrn);                                                  160512
006100                 updhtmlvar('sampsales1':%editc(sampsales1:'L'));                                      160512
006200                 updhtmlvar('sampsales2':%editc(sampsales2:'L'));                                      160512
006300                 updhtmlvar('sampsales3':%editc(sampsales3:'L'));                                      160512
006400                 updhtmlvar('sampsales4':%editc(sampsales4:'L'));                                      160512
006500                 wrtsection('row');                                                                    160512
006600                 read samprcd;                                                                         160512
006700             enddo;                                                                                    160512
006800                                                                                                       160512
006900           //End table                                                                                 160512
007000             wrtsection('tableend');                                                                   160512
007100                                                                                                       160512
007200           //Send the output to the browser                                                            160512
007300             wrtsection('*fini');                                                                      160512
007400                                                                                                       160512
007500           //Back to the caller                                                                        160512
007600             return;                                                                                   160512
007700                                                                                                       160512